summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/lluri.cpp3
-rw-r--r--indra/llcommon/lluuid.cpp162
-rw-r--r--indra/llinventory/llinventorydefines.h2
-rw-r--r--indra/llmessage/llcurl.cpp29
-rw-r--r--indra/llmessage/llcurl.h12
-rw-r--r--indra/llmessage/llhttpclient.cpp20
-rw-r--r--indra/llmessage/llhttpclient.h11
-rw-r--r--indra/llmessage/llurlrequest.cpp51
-rw-r--r--indra/llmessage/llurlrequest.h68
-rw-r--r--indra/llui/CMakeLists.txt2
-rw-r--r--indra/llui/llaccordionctrltab.cpp51
-rw-r--r--indra/llui/llaccordionctrltab.h6
-rw-r--r--indra/llui/llfiltereditor.cpp1
-rw-r--r--indra/llui/llflatlistview.cpp44
-rw-r--r--indra/llui/llflatlistview.h2
-rw-r--r--indra/llui/llurlentry.cpp29
-rw-r--r--indra/llui/tests/llurlentry_test.cpp26
-rw-r--r--indra/llvfs/lldir.cpp39
-rw-r--r--indra/llvfs/lldir.h4
-rw-r--r--indra/newview/CMakeLists.txt61
-rw-r--r--indra/newview/Info-SecondLife.plist28
-rw-r--r--indra/newview/app_settings/keywords.ini1
-rw-r--r--indra/newview/app_settings/settings.xml166
-rw-r--r--indra/newview/featuretable.txt5
-rw-r--r--indra/newview/gpu_table.txt83
-rw-r--r--indra/newview/installers/windows/installer_template.nsi6
-rw-r--r--indra/newview/llagent.cpp12
-rw-r--r--indra/newview/llagent.h5
-rw-r--r--indra/newview/llagentlistener.cpp5
-rw-r--r--indra/newview/llagentui.cpp17
-rw-r--r--indra/newview/llagentui.h4
-rw-r--r--indra/newview/llagentwearables.cpp253
-rw-r--r--indra/newview/llagentwearables.h61
-rw-r--r--indra/newview/llagentwearablesfetch.h6
-rw-r--r--indra/newview/llappearancemgr.cpp99
-rw-r--r--indra/newview/llappviewer.cpp124
-rw-r--r--indra/newview/llappviewer.h1
-rw-r--r--indra/newview/llappviewerlinux.cpp2
-rw-r--r--indra/newview/llappviewermacosx.cpp1
-rw-r--r--indra/newview/llavataractions.cpp2
-rw-r--r--indra/newview/llavatarlist.cpp4
-rw-r--r--indra/newview/llavatarlistitem.cpp7
-rw-r--r--indra/newview/llbottomtray.cpp235
-rw-r--r--indra/newview/llbottomtray.h138
-rw-r--r--indra/newview/llcallfloater.cpp29
-rw-r--r--indra/newview/llcallingcard.cpp1
-rw-r--r--indra/newview/llchathistory.cpp15
-rw-r--r--indra/newview/llchatitemscontainerctrl.cpp2
-rw-r--r--indra/newview/llchiclet.cpp35
-rw-r--r--indra/newview/llcofwearables.cpp65
-rw-r--r--indra/newview/llcofwearables.h48
-rw-r--r--indra/newview/llcurrencyuimanager.cpp2
-rw-r--r--indra/newview/lldriverparam.cpp4
-rw-r--r--indra/newview/lldriverparam.h4
-rw-r--r--indra/newview/llfloaterabout.cpp14
-rw-r--r--indra/newview/llfloateravatartextures.cpp4
-rw-r--r--indra/newview/llfloaterbuy.cpp10
-rw-r--r--indra/newview/llfloaterbuycontents.cpp5
-rw-r--r--indra/newview/llfloaterbuyland.cpp4
-rw-r--r--indra/newview/llfloaterchat.cpp2
-rw-r--r--indra/newview/llfloaterchatterbox.cpp2
-rw-r--r--indra/newview/llfloaterevent.cpp2
-rw-r--r--indra/newview/llfloaterland.cpp11
-rw-r--r--indra/newview/llfloaterpreference.cpp4
-rw-r--r--indra/newview/llfloaterregioninfo.cpp3
-rw-r--r--indra/newview/llfloaterreporter.cpp12
-rw-r--r--indra/newview/llfloatersellland.cpp8
-rw-r--r--indra/newview/llfloatersnapshot.cpp2
-rw-r--r--indra/newview/llfloaterurlentry.cpp5
-rw-r--r--indra/newview/llfloatervoicedevicesettings.cpp41
-rw-r--r--indra/newview/llfloaterworldmap.cpp23
-rw-r--r--indra/newview/llfloaterworldmap.h3
-rw-r--r--indra/newview/llfolderview.cpp9
-rw-r--r--indra/newview/llfolderview.h3
-rw-r--r--indra/newview/llfolderviewitem.cpp9
-rw-r--r--indra/newview/llfolderviewitem.h2
-rw-r--r--indra/newview/llgrouplist.cpp4
-rw-r--r--indra/newview/llimfloater.cpp44
-rw-r--r--indra/newview/llimfloater.h7
-rw-r--r--indra/newview/llimpanel.cpp14
-rw-r--r--indra/newview/llimview.cpp25
-rw-r--r--indra/newview/llinspectavatar.cpp8
-rw-r--r--indra/newview/llinspectobject.cpp6
-rw-r--r--indra/newview/llinspectremoteobject.cpp4
-rw-r--r--indra/newview/llinventorybridge.cpp427
-rw-r--r--indra/newview/llinventorybridge.h314
-rw-r--r--indra/newview/llinventoryfunctions.cpp294
-rw-r--r--indra/newview/llinventoryfunctions.h42
-rw-r--r--indra/newview/llinventoryicon.cpp187
-rw-r--r--indra/newview/llinventoryicon.h108
-rw-r--r--indra/newview/llinventoryitemslist.cpp34
-rw-r--r--indra/newview/llinventoryitemslist.h23
-rw-r--r--indra/newview/llinventorymodel.cpp335
-rw-r--r--indra/newview/llinventorymodel.h620
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp178
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.h21
-rw-r--r--indra/newview/llinventorypanel.cpp33
-rw-r--r--indra/newview/lllandmarkactions.cpp4
-rw-r--r--indra/newview/lllocationinputctrl.cpp9
-rw-r--r--indra/newview/llloginhandler.cpp200
-rw-r--r--indra/newview/llloginhandler.h11
-rw-r--r--indra/newview/lllogininstance.cpp78
-rw-r--r--indra/newview/lllogininstance.h7
-rw-r--r--indra/newview/llmoveview.cpp29
-rw-r--r--indra/newview/llmoveview.h3
-rw-r--r--indra/newview/llnavigationbar.cpp34
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp6
-rw-r--r--indra/newview/llnotificationstorage.cpp5
-rw-r--r--indra/newview/lloutfitslist.cpp131
-rw-r--r--indra/newview/lloutfitslist.h11
-rw-r--r--indra/newview/lloutputmonitorctrl.cpp8
-rw-r--r--indra/newview/lloutputmonitorctrl.h2
-rw-r--r--indra/newview/lloverlaybar.cpp2
-rw-r--r--indra/newview/llpanelavatar.cpp8
-rw-r--r--indra/newview/llpaneleditwearable.cpp119
-rw-r--r--indra/newview/llpaneleditwearable.h9
-rw-r--r--indra/newview/llpanelgroup.cpp72
-rw-r--r--indra/newview/llpanelgroup.h6
-rw-r--r--indra/newview/llpanelgroupgeneral.cpp11
-rw-r--r--indra/newview/llpanelgroupnotices.cpp12
-rw-r--r--indra/newview/llpanelgrouproles.cpp4
-rw-r--r--indra/newview/llpanelimcontrolpanel.cpp5
-rw-r--r--indra/newview/llpanellandmarks.cpp30
-rw-r--r--indra/newview/llpanellandmarks.h1
-rw-r--r--indra/newview/llpanellogin.cpp540
-rw-r--r--indra/newview/llpanellogin.h28
-rw-r--r--indra/newview/llpanelmaininventory.cpp9
-rw-r--r--indra/newview/llpanelobjectinventory.cpp319
-rw-r--r--indra/newview/llpaneloutfitedit.cpp217
-rw-r--r--indra/newview/llpaneloutfitedit.h37
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp36
-rw-r--r--indra/newview/llpaneloutfitsinventory.h2
-rw-r--r--indra/newview/llpanelpeople.cpp4
-rw-r--r--indra/newview/llpanelplaces.cpp16
-rw-r--r--indra/newview/llpanelplacestab.cpp5
-rw-r--r--indra/newview/llpanelplacestab.h1
-rw-r--r--indra/newview/llpanelteleporthistory.cpp11
-rw-r--r--indra/newview/llpanelteleporthistory.h3
-rw-r--r--indra/newview/llparticipantlist.cpp57
-rw-r--r--indra/newview/llparticipantlist.h2
-rw-r--r--indra/newview/llscriptfloater.cpp2
-rw-r--r--indra/newview/llsecapi.cpp194
-rw-r--r--indra/newview/llsecapi.h499
-rw-r--r--indra/newview/llsechandler_basic.cpp1612
-rw-r--r--indra/newview/llsechandler_basic.h285
-rw-r--r--indra/newview/llselectmgr.cpp8
-rw-r--r--indra/newview/llsidepanelappearance.cpp14
-rw-r--r--indra/newview/llsidepanelappearance.h1
-rw-r--r--indra/newview/llsidepanelinventory.cpp3
-rw-r--r--indra/newview/llslurl.cpp514
-rw-r--r--indra/newview/llslurl.h159
-rw-r--r--indra/newview/llspeakbutton.cpp10
-rw-r--r--indra/newview/llspeakers.cpp40
-rw-r--r--indra/newview/llspeakingindicatormanager.cpp4
-rw-r--r--indra/newview/llstartup.cpp716
-rw-r--r--indra/newview/llstartup.h17
-rw-r--r--indra/newview/llstylemap.cpp2
-rw-r--r--indra/newview/llsyswellwindow.cpp103
-rw-r--r--indra/newview/llsyswellwindow.h17
-rw-r--r--indra/newview/lltexlayer.cpp4
-rw-r--r--indra/newview/lltexlayerparams.cpp4
-rw-r--r--indra/newview/lltexturecache.cpp177
-rw-r--r--indra/newview/lltexturecache.h7
-rw-r--r--indra/newview/lltoastgroupnotifypanel.cpp5
-rw-r--r--indra/newview/lltoastnotifypanel.cpp5
-rw-r--r--indra/newview/llurl.cpp6
-rw-r--r--indra/newview/llurl.h1
-rw-r--r--indra/newview/llurldispatcher.cpp201
-rw-r--r--indra/newview/llurldispatcher.h19
-rw-r--r--indra/newview/llurllineeditorctrl.cpp2
-rw-r--r--indra/newview/llvieweraudio.cpp10
-rw-r--r--indra/newview/llviewercontrol.cpp2
-rw-r--r--indra/newview/llviewerdisplay.cpp1
-rw-r--r--indra/newview/llviewerinventory.cpp33
-rw-r--r--indra/newview/llviewerinventory.h6
-rw-r--r--indra/newview/llviewermediafocus.cpp54
-rw-r--r--indra/newview/llviewermenu.cpp24
-rw-r--r--indra/newview/llviewermessage.cpp62
-rw-r--r--indra/newview/llviewernetwork.cpp693
-rw-r--r--indra/newview/llviewernetwork.h182
-rw-r--r--indra/newview/llviewerobject.cpp12
-rw-r--r--indra/newview/llviewerstats.cpp6
-rw-r--r--indra/newview/llviewervisualparam.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp32
-rw-r--r--indra/newview/llvoavatar.cpp68
-rw-r--r--indra/newview/llvoavatar.h21
-rw-r--r--indra/newview/llvoavatardefines.cpp64
-rw-r--r--indra/newview/llvoavatardefines.h8
-rw-r--r--indra/newview/llvoavatarself.cpp40
-rw-r--r--indra/newview/llvoavatarself.h9
-rw-r--r--indra/newview/llvoicechannel.cpp64
-rw-r--r--indra/newview/llvoicechannel.h3
-rw-r--r--indra/newview/llvoiceclient.cpp7244
-rw-r--r--indra/newview/llvoiceclient.h1034
-rw-r--r--indra/newview/llvoicevivox.cpp6944
-rw-r--r--indra/newview/llvoicevivox.h917
-rw-r--r--indra/newview/llvovolume.cpp5
-rw-r--r--indra/newview/llwearable.cpp34
-rw-r--r--indra/newview/llwearable.h10
-rw-r--r--indra/newview/llwearableitemslist.cpp81
-rw-r--r--indra/newview/llwearableitemslist.h37
-rw-r--r--indra/newview/llwearablelist.cpp6
-rw-r--r--indra/newview/llwearablelist.h2
-rw-r--r--indra/newview/llwearabletype.cpp138
-rw-r--r--indra/newview/llwearabletype.h78
-rw-r--r--indra/newview/llweb.cpp2
-rw-r--r--indra/newview/llworld.cpp3
-rw-r--r--indra/newview/llworldmipmap.cpp5
-rw-r--r--indra/newview/llworldview.cpp61
-rw-r--r--indra/newview/llxmlrpclistener.cpp18
-rw-r--r--indra/newview/llxmlrpctransaction.cpp108
-rw-r--r--indra/newview/llxmlrpctransaction.h3
-rw-r--r--indra/newview/pipeline.cpp7
-rw-r--r--indra/newview/pipeline.h1
-rw-r--r--indra/newview/skins/default/colors.xml3
-rw-r--r--indra/newview/skins/default/textures/bottomtray/Movement_Left_Off.pngbin0 -> 47887 bytes
-rw-r--r--indra/newview/skins/default/textures/bottomtray/Movement_Left_On.pngbin0 -> 47995 bytes
-rw-r--r--indra/newview/skins/default/textures/bottomtray/Movement_Right_Off.pngbin0 -> 48333 bytes
-rw-r--r--indra/newview/skins/default/textures/bottomtray/Movement_Right_On.pngbin0 -> 47187 bytes
-rw-r--r--indra/newview/skins/default/textures/icons/Female.pngbin0 -> 309 bytes
-rw-r--r--indra/newview/skins/default/textures/icons/Generic_Group_Large.pngbin0 -> 7905 bytes
-rw-r--r--indra/newview/skins/default/textures/icons/Male.pngbin0 -> 302 bytes
-rw-r--r--indra/newview/skins/default/textures/textures.xml39
-rw-r--r--indra/newview/skins/default/xui/da/floater_about.xml9
-rw-r--r--indra/newview/skins/default/xui/da/floater_animation_preview.xml48
-rw-r--r--indra/newview/skins/default/xui/da/floater_day_cycle_options.xml41
-rw-r--r--indra/newview/skins/default/xui/da/floater_god_tools.xml12
-rw-r--r--indra/newview/skins/default/xui/da/floater_image_preview.xml20
-rw-r--r--indra/newview/skins/default/xui/da/floater_outgoing_call.xml2
-rw-r--r--indra/newview/skins/default/xui/da/floater_snapshot.xml89
-rw-r--r--indra/newview/skins/default/xui/da/floater_tos.xml12
-rw-r--r--indra/newview/skins/default/xui/da/menu_attachment_other.xml2
-rw-r--r--indra/newview/skins/default/xui/da/menu_attachment_self.xml1
-rw-r--r--indra/newview/skins/default/xui/da/menu_avatar_other.xml2
-rw-r--r--indra/newview/skins/default/xui/da/menu_avatar_self.xml1
-rw-r--r--indra/newview/skins/default/xui/da/menu_edit.xml12
-rw-r--r--indra/newview/skins/default/xui/da/menu_inspect_avatar_gear.xml2
-rw-r--r--indra/newview/skins/default/xui/da/menu_inspect_self_gear.xml1
-rw-r--r--indra/newview/skins/default/xui/da/menu_inv_offer_chiclet.xml4
-rw-r--r--indra/newview/skins/default/xui/da/menu_inventory.xml1
-rw-r--r--indra/newview/skins/default/xui/da/menu_login.xml15
-rw-r--r--indra/newview/skins/default/xui/da/menu_participant_list.xml1
-rw-r--r--indra/newview/skins/default/xui/da/menu_save_outfit.xml5
-rw-r--r--indra/newview/skins/default/xui/da/menu_script_chiclet.xml4
-rw-r--r--indra/newview/skins/default/xui/da/menu_viewer.xml16
-rw-r--r--indra/newview/skins/default/xui/da/notifications.xml47
-rw-r--r--indra/newview/skins/default/xui/da/outfit_accordion_tab.xml4
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_eyes.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_gloves.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_hair.xml14
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_jacket.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_pants.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_shape.xml24
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_shirt.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_shoes.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_skin.xml14
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_skirt.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_socks.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_underpants.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_undershirt.xml8
-rw-r--r--indra/newview/skins/default/xui/da/panel_edit_wearable.xml5
-rw-r--r--indra/newview/skins/default/xui/da/panel_group_general.xml5
-rw-r--r--indra/newview/skins/default/xui/da/panel_im_control_panel.xml2
-rw-r--r--indra/newview/skins/default/xui/da/panel_inventory_item.xml4
-rw-r--r--indra/newview/skins/default/xui/da/panel_media_settings_permissions.xml9
-rw-r--r--indra/newview/skins/default/xui/da/panel_nearby_media.xml22
-rw-r--r--indra/newview/skins/default/xui/da/panel_outfit_edit.xml48
-rw-r--r--indra/newview/skins/default/xui/da/panel_outfits_inventory.xml4
-rw-r--r--indra/newview/skins/default/xui/da/panel_people.xml21
-rw-r--r--indra/newview/skins/default/xui/da/panel_places.xml1
-rw-r--r--indra/newview/skins/default/xui/da/panel_preferences_advanced.xml4
-rw-r--r--indra/newview/skins/default/xui/da/panel_world_map.xml6
-rw-r--r--indra/newview/skins/default/xui/da/sidepanel_inventory.xml1
-rw-r--r--indra/newview/skins/default/xui/da/strings.xml45
-rw-r--r--indra/newview/skins/default/xui/de/floater_about_land.xml2
-rw-r--r--indra/newview/skins/default/xui/de/floater_buy_currency.xml5
-rw-r--r--indra/newview/skins/default/xui/de/floater_color_picker.xml2
-rw-r--r--indra/newview/skins/default/xui/de/floater_hardware_settings.xml2
-rw-r--r--indra/newview/skins/default/xui/de/panel_preferences_chat.xml2
-rw-r--r--indra/newview/skins/default/xui/de/strings.xml2
-rw-r--r--indra/newview/skins/default/xui/en/floater_about.xml2
-rw-r--r--indra/newview/skins/default/xui/en/floater_land_holdings.xml12
-rw-r--r--indra/newview/skins/default/xui/en/floater_moveview.xml146
-rw-r--r--indra/newview/skins/default/xui/en/main_view.xml2
-rw-r--r--indra/newview/skins/default/xui/en/menu_login.xml2
-rw-r--r--indra/newview/skins/default/xui/en/menu_participant_list.xml198
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml3
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml233
-rw-r--r--indra/newview/skins/default/xui/en/panel_bottomtray.xml332
-rw-r--r--indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml73
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_shape.xml61
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_wearable.xml110
-rw-r--r--indra/newview/skins/default/xui/en/panel_group_general.xml1
-rw-r--r--indra/newview/skins/default/xui/en/panel_group_notices.xml18
-rw-r--r--indra/newview/skins/default/xui/en/panel_login.xml37
-rw-r--r--indra/newview/skins/default/xui/en/panel_main_inventory.xml140
-rw-r--r--indra/newview/skins/default/xui/en/panel_outfit_edit.xml198
-rw-r--r--indra/newview/skins/default/xui/en/panel_people.xml6
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_advanced.xml10
-rw-r--r--indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml6
-rw-r--r--indra/newview/skins/default/xui/en/sidepanel_appearance.xml8
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml9
-rw-r--r--indra/newview/skins/default/xui/es/floater_world_map.xml4
-rw-r--r--indra/newview/skins/default/xui/es/menu_inventory.xml3
-rw-r--r--indra/newview/skins/default/xui/es/menu_login.xml1
-rw-r--r--indra/newview/skins/default/xui/fr/strings.xml2
-rw-r--r--indra/newview/skins/default/xui/it/floater_about_land.xml24
-rw-r--r--indra/newview/skins/default/xui/it/floater_animation_preview.xml2
-rw-r--r--indra/newview/skins/default/xui/it/floater_report_abuse.xml4
-rw-r--r--indra/newview/skins/default/xui/it/floater_tools.xml83
-rw-r--r--indra/newview/skins/default/xui/it/menu_inventory.xml35
-rw-r--r--indra/newview/skins/default/xui/it/menu_login.xml1
-rw-r--r--indra/newview/skins/default/xui/it/menu_viewer.xml6
-rw-r--r--indra/newview/skins/default/xui/it/notifications.xml12
-rw-r--r--indra/newview/skins/default/xui/it/panel_group_general.xml6
-rw-r--r--indra/newview/skins/default/xui/it/panel_landmark_info.xml2
-rw-r--r--indra/newview/skins/default/xui/it/panel_place_profile.xml2
-rw-r--r--indra/newview/skins/default/xui/it/panel_preferences_general.xml12
-rw-r--r--indra/newview/skins/default/xui/it/panel_region_general.xml8
-rw-r--r--indra/newview/skins/default/xui/it/panel_region_general_layout.xml2
-rw-r--r--indra/newview/skins/default/xui/it/strings.xml6
-rw-r--r--indra/newview/skins/default/xui/ja/inspect_avatar.xml4
-rw-r--r--indra/newview/skins/default/xui/ja/notifications.xml2
-rw-r--r--indra/newview/skins/default/xui/nl/floater_tools.xml2
-rw-r--r--indra/newview/skins/default/xui/pl/menu_login.xml1
-rw-r--r--indra/newview/skins/default/xui/pt/floater_god_tools.xml10
-rw-r--r--indra/newview/skins/default/xui/pt/floater_tools.xml8
-rw-r--r--indra/newview/skins/default/xui/pt/menu_inventory.xml3
-rw-r--r--indra/newview/skins/default/xui/pt/menu_login.xml1
-rw-r--r--indra/newview/skins/default/xui/pt/notifications.xml115
-rw-r--r--indra/newview/skins/default/xui/pt/panel_people.xml10
-rw-r--r--indra/newview/skins/default/xui/pt/panel_region_debug.xml22
-rw-r--r--indra/newview/skins/default/xui/pt/panel_region_general_layout.xml4
-rw-r--r--indra/newview/tests/lllogininstance_test.cpp122
-rw-r--r--indra/newview/tests/llsecapi_test.cpp188
-rw-r--r--indra/newview/tests/llsechandler_basic_test.cpp1051
-rw-r--r--indra/newview/tests/llslurl_test.cpp258
-rw-r--r--indra/newview/tests/llviewernetwork_test.cpp456
-rwxr-xr-xindra/newview/viewer_manifest.py1
-rw-r--r--indra/viewer_components/login/lllogin.cpp43
-rw-r--r--install.xml4
341 files changed, 21325 insertions, 13389 deletions
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index 9d4f3a98f0..0e8f3f0f73 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -231,7 +231,8 @@ static BOOL isDefault(const std::string& scheme, U16 port)
void LLURI::parseAuthorityAndPathUsingOpaque()
{
if (mScheme == "http" || mScheme == "https" ||
- mScheme == "ftp" || mScheme == "secondlife" )
+ mScheme == "ftp" || mScheme == "secondlife" ||
+ mScheme == "x-grid-location-info")
{
if (mEscapedOpaque.substr(0,2) != "//")
{
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index bcbae06ec5..583c1e589b 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -33,9 +33,12 @@
// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
#if LL_WINDOWS
-# undef WIN32_LEAN_AND_MEAN
-# include <winsock2.h>
-# include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#include <winsock2.h>
+#include <windows.h>
+// ugh, this is ugly. We need to straighten out our linking for this library
+#pragma comment(lib, "IPHLPAPI.lib")
+#include <iphlpapi.h>
#endif
#include "lldefs.h"
@@ -452,67 +455,102 @@ static void get_random_bytes(void *buf, int nbytes)
return;
}
-#if LL_WINDOWS
-typedef struct _ASTAT_
-{
- ADAPTER_STATUS adapt;
- NAME_BUFFER NameBuff [30];
-}ASTAT, * PASTAT;
+#if LL_WINDOWS
+// Code copied from http://msdn.microsoft.com/en-us/library/aa365939(VS.85).aspx
+// This code grabs the first hardware address, rather than the first interface.
+// Using a VPN can cause the first returned interface to be changed.
+
+const S32 MAC_ADDRESS_BYTES=6;
+
// static
-S32 LLUUID::getNodeID(unsigned char * node_id)
-{
- ASTAT Adapter;
- NCB Ncb;
- UCHAR uRetCode;
- LANA_ENUM lenum;
- int i;
- int retval = 0;
-
- memset( &Ncb, 0, sizeof(Ncb) );
- Ncb.ncb_command = NCBENUM;
- Ncb.ncb_buffer = (UCHAR *)&lenum;
- Ncb.ncb_length = sizeof(lenum);
- uRetCode = Netbios( &Ncb );
- // printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
-
- for(i=0; i < lenum.length ;i++)
- {
- memset( &Ncb, 0, sizeof(Ncb) );
- Ncb.ncb_command = NCBRESET;
- Ncb.ncb_lana_num = lenum.lana[i];
-
- uRetCode = Netbios( &Ncb );
- // printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
- // lenum.lana[i], uRetCode );
-
- memset( &Ncb, 0, sizeof (Ncb) );
- Ncb.ncb_command = NCBASTAT;
- Ncb.ncb_lana_num = lenum.lana[i];
-
- strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */
- Ncb.ncb_buffer = (unsigned char *)&Adapter;
- Ncb.ncb_length = sizeof(Adapter);
-
- uRetCode = Netbios( &Ncb );
-// printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
-// lenum.lana[i], uRetCode );
- if ( uRetCode == 0 )
- {
-// printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
-// lenum.lana[i],
-// Adapter.adapt.adapter_address[0],
-// Adapter.adapt.adapter_address[1],
-// Adapter.adapt.adapter_address[2],
-// Adapter.adapt.adapter_address[3],
-// Adapter.adapt.adapter_address[4],
-// Adapter.adapt.adapter_address[5] );
- memcpy(node_id,Adapter.adapt.adapter_address,6); /* Flawfinder: ignore */
- retval = 1;
-
- }
- }
- return retval;
+S32 LLUUID::getNodeID(unsigned char *node_id)
+{
+
+ // Declare and initialize variables.
+ DWORD dwSize = 0;
+ DWORD dwRetVal = 0;
+ int i;
+
+/* variables used for GetIfTable and GetIfEntry */
+ MIB_IFTABLE *pIfTable;
+ MIB_IFROW *pIfRow;
+
+ // Allocate memory for our pointers.
+ pIfTable = (MIB_IFTABLE *) malloc(sizeof (MIB_IFTABLE));
+ if (pIfTable == NULL)
+ {
+ printf("Error allocating memory needed to call GetIfTable\n");
+ return 0;
+ }
+
+ // Before calling GetIfEntry, we call GetIfTable to make
+ // sure there are entries to get and retrieve the interface index.
+
+ // Make an initial call to GetIfTable to get the
+ // necessary size into dwSize
+ if (GetIfTable(pIfTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER) {
+ free(pIfTable);
+ pIfTable = (MIB_IFTABLE *) malloc(dwSize);
+ if (pIfTable == NULL)
+ {
+ printf("Error allocating memory\n");
+ return 0;
+ }
+ }
+ // Make a second call to GetIfTable to get the actual
+ // data we want.
+ if ((dwRetVal = GetIfTable(pIfTable, &dwSize, 0)) == NO_ERROR)
+ {
+ if (pIfTable->dwNumEntries > 0)
+ {
+ pIfRow = (MIB_IFROW *) malloc(sizeof (MIB_IFROW));
+ if (pIfRow == NULL)
+ {
+ printf("Error allocating memory\n");
+ if (pIfTable != NULL)
+ {
+ free(pIfTable);
+ pIfTable = NULL;
+ }
+ return 0;
+ }
+
+ int limit = MAC_ADDRESS_BYTES;
+ memcpy(node_id, "\0\0\0\0\0\0", limit); // zero out array of bytes
+ for (i = 0; i < (int) pIfTable->dwNumEntries; i++)
+ {
+ pIfRow->dwIndex = pIfTable->table[i].dwIndex;
+ if ((dwRetVal = GetIfEntry(pIfRow)) == NO_ERROR)
+ {
+ switch (pIfRow->dwType)
+ {
+ case IF_TYPE_ETHERNET_CSMACD:
+ case IF_TYPE_IEEE80211:
+ limit = min((int) pIfRow->dwPhysAddrLen, limit);
+ if (pIfRow->dwPhysAddrLen == 0)
+ break;
+ memcpy(node_id, (UCHAR *)&pIfRow->bPhysAddr[0], limit); // just incase the PhysAddr is not the expected MAC_Address size
+ free(pIfTable);
+ return 1; //return first hardware device found.
+ break;
+
+ case IF_TYPE_OTHER:
+ case IF_TYPE_PPP:
+ case IF_TYPE_SOFTWARE_LOOPBACK:
+ case IF_TYPE_ISO88025_TOKENRING:
+ case IF_TYPE_IEEE1394:
+ case IF_TYPE_ATM:
+ case IF_TYPE_TUNNEL:
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ free(pIfTable);
+ return 0;
}
#elif LL_DARWIN
diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h
index ccf1a356de..67e629c546 100644
--- a/indra/llinventory/llinventorydefines.h
+++ b/indra/llinventory/llinventorydefines.h
@@ -89,7 +89,7 @@ public:
II_FLAGS_WEARABLES_MASK = 0xff,
// Wearables use the low order byte of flags to store the
- // EWearableType enumeration found in newview/llwearable.h
+ // LLWearableType::EType enumeration found in newview/llwearable.h
II_FLAGS_PERM_OVERWRITE_MASK = (II_FLAGS_OBJECT_SLAM_PERM |
II_FLAGS_OBJECT_SLAM_SALE |
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 024e17a777..91e11b8c0d 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -89,10 +89,6 @@ S32 gCurlMultiCount = 0;
std::vector<LLMutex*> LLCurl::sSSLMutex;
std::string LLCurl::sCAPath;
std::string LLCurl::sCAFile;
-// Verify SSL certificates by default (matches libcurl default). The ability
-// to alter this flag is only to allow us to suppress verification if it's
-// broken for some reason.
-bool LLCurl::sSSLVerify = true;
//static
void LLCurl::setCAPath(const std::string& path)
@@ -107,18 +103,6 @@ void LLCurl::setCAFile(const std::string& file)
}
//static
-void LLCurl::setSSLVerify(bool verify)
-{
- sSSLVerify = verify;
-}
-
-//static
-bool LLCurl::getSSLVerify()
-{
- return sSSLVerify;
-}
-
-//static
std::string LLCurl::getVersionString()
{
return std::string(curl_version());
@@ -481,8 +465,7 @@ void LLCurl::Easy::prepRequest(const std::string& url,
setErrorBuffer();
setCA();
- setopt(CURLOPT_SSL_VERIFYPEER, LLCurl::getSSLVerify());
- setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify()? 2 : 0);
+ setopt(CURLOPT_SSL_VERIFYPEER, true);
setopt(CURLOPT_TIMEOUT, CURL_REQUEST_TIMEOUT);
setoptString(CURLOPT_URL, url);
@@ -912,6 +895,15 @@ void LLCurlEasyRequest::setReadCallback(curl_read_callback callback, void* userd
}
}
+void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata)
+{
+ if (mEasy)
+ {
+ mEasy->setopt(CURLOPT_SSL_CTX_FUNCTION, (void*)callback);
+ mEasy->setopt(CURLOPT_SSL_CTX_DATA, userdata);
+ }
+}
+
void LLCurlEasyRequest::slist_append(const char* str)
{
if (mEasy)
@@ -1061,3 +1053,4 @@ void LLCurl::cleanupClass()
#endif
curl_global_cleanup();
}
+
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index caf02cccd9..b6a637ae5b 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -158,16 +158,6 @@ public:
static const std::string& getCAPath() { return sCAPath; }
/**
- * @ brief Set flag controlling whether to verify HTTPS certs.
- */
- static void setSSLVerify(bool verify);
-
- /**
- * @ brief Get flag controlling whether to verify HTTPS certs.
- */
- static bool getSSLVerify();
-
- /**
* @ brief Initialize LLCurl class
*/
static void initClass();
@@ -192,7 +182,6 @@ public:
private:
static std::string sCAPath;
static std::string sCAFile;
- static bool sSSLVerify;
};
namespace boost
@@ -240,6 +229,7 @@ public:
void setHeaderCallback(curl_header_callback callback, void* userdata);
void setWriteCallback(curl_write_callback callback, void* userdata);
void setReadCallback(curl_read_callback callback, void* userdata);
+ void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata);
void slist_append(const char* str);
void sendRequest(const std::string& url);
void requestComplete();
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index dd56e18caf..9c2e4b5658 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -31,7 +31,7 @@
*/
#include "linden_common.h"
-
+#include <openssl/x509_vfy.h>
#include "llhttpclient.h"
#include "llassetstorage.h"
@@ -46,7 +46,10 @@
#include "message.h"
#include <curl/curl.h>
+
const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
+LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL;
+
////////////////////////////////////////////////////////////////////////////
// Responder class moved to LLCurl
@@ -79,8 +82,10 @@ namespace
{
if (mResponder.get())
{
- mResponder->completedRaw(mStatus, mReason, channels, buffer);
+ // Allow clients to parse headers before we attempt to parse
+ // the body and provide completed/result/error calls.
mResponder->completedHeader(mStatus, mReason, mHeaderOutput);
+ mResponder->completedRaw(mStatus, mReason, channels, buffer);
}
}
virtual void header(const std::string& header, const std::string& value)
@@ -206,13 +211,19 @@ namespace
LLPumpIO* theClientPump = NULL;
}
+void LLHTTPClient::setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback)
+{
+ LLHTTPClient::mCertVerifyCallback = callback;
+}
+
static void request(
const std::string& url,
LLURLRequest::ERequestAction method,
Injector* body_injector,
LLCurl::ResponderPtr responder,
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
- const LLSD& headers = LLSD())
+ const LLSD& headers = LLSD()
+ )
{
if (!LLHTTPClient::hasPump())
{
@@ -222,7 +233,7 @@ static void request(
LLPumpIO::chain_t chain;
LLURLRequest* req = new LLURLRequest(method, url);
- req->checkRootCertificate(LLCurl::getSSLVerify());
+ req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
@@ -417,7 +428,6 @@ static LLSD blocking_request(
std::string body_str;
// other request method checks root cert first, we skip?
- //req->checkRootCertificate(true);
// * Set curl handle options
curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1); // don't use SIGALRM for timeouts
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index 3d0646e5fe..8afbc9e0fc 100644
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -40,7 +40,8 @@
#include <string>
#include <boost/intrusive_ptr.hpp>
-
+#include <openssl/x509_vfy.h>
+#include "llurlrequest.h"
#include "llassettype.h"
#include "llcurl.h"
#include "lliopipe.h"
@@ -61,6 +62,7 @@ public:
typedef LLCurl::Responder Responder;
typedef LLCurl::ResponderPtr ResponderPtr;
+
/** @name non-blocking API */
//@{
static void head(
@@ -155,7 +157,12 @@ public:
static void setPump(LLPumpIO& pump);
///< must be called before any of the above calls are made
static bool hasPump();
- ///< for testing
+
+ static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback);
+ static LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; }
+
+protected:
+ static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback;
};
#endif // LL_LLHTTPCLIENT_H
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 4e7ceff984..1e76d10828 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -36,7 +36,8 @@
#include "llurlrequest.h"
#include <algorithm>
-
+#include <openssl/x509_vfy.h>
+#include <openssl/ssl.h>
#include "llcurl.h"
#include "llioutil.h"
#include "llmemtype.h"
@@ -56,6 +57,8 @@ const std::string CONTEXT_TRANSFERED_BYTES("transfered_bytes");
static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user);
+
+
/**
* class LLURLRequestDetail
*/
@@ -72,6 +75,7 @@ public:
U32 mBodyLimit;
S32 mByteAccumulator;
bool mIsBodyLimitSet;
+ LLURLRequest::SSLCertVerifyCallback mSSLVerifyCallback;
};
LLURLRequestDetail::LLURLRequestDetail() :
@@ -80,7 +84,8 @@ LLURLRequestDetail::LLURLRequestDetail() :
mLastRead(NULL),
mBodyLimit(0),
mByteAccumulator(0),
- mIsBodyLimitSet(false)
+ mIsBodyLimitSet(false),
+ mSSLVerifyCallback(NULL)
{
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
mCurlRequest = new LLCurlEasyRequest();
@@ -94,6 +99,36 @@ LLURLRequestDetail::~LLURLRequestDetail()
mLastRead = NULL;
}
+void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *param)
+{
+ mDetail->mSSLVerifyCallback = callback;
+ mDetail->mCurlRequest->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this);
+ mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, true);
+ mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, 2);
+}
+
+
+// _sslCtxFunction
+// Callback function called when an SSL Context is created via CURL
+// used to configure the context for custom cert validation
+
+CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
+{
+ LLURLRequest *req = (LLURLRequest *)param;
+ if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL)
+ {
+ SSL_CTX_set_cert_verify_callback((SSL_CTX *)sslctx, NULL, NULL);
+ return CURLE_OK;
+ }
+ SSL_CTX * ctx = (SSL_CTX *) sslctx;
+ // disable any default verification for server certs
+ SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
+ // set the verification callback.
+ SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req);
+ // the calls are void
+ return CURLE_OK;
+
+}
/**
* class LLURLRequest
@@ -148,6 +183,11 @@ void LLURLRequest::setURL(const std::string& url)
mDetail->mURL = url;
}
+std::string LLURLRequest::getURL() const
+{
+ return mDetail->mURL;
+}
+
void LLURLRequest::addHeader(const char* header)
{
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
@@ -160,13 +200,6 @@ void LLURLRequest::setBodyLimit(U32 size)
mDetail->mIsBodyLimitSet = true;
}
-void LLURLRequest::checkRootCertificate(bool check)
-{
- mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, (check? TRUE : FALSE));
- mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, (check? 2 : 0));
- mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, "");
-}
-
void LLURLRequest::setCallback(LLURLRequestComplete* callback)
{
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index cb3c466440..69fd22e592 100644
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -44,6 +44,8 @@
#include "lliopipe.h"
#include "llchainio.h"
#include "llerror.h"
+#include <openssl/x509_vfy.h>
+#include "llcurl.h"
extern const std::string CONTEXT_REQUEST;
@@ -72,6 +74,8 @@ class LLURLRequest : public LLIOPipe
{
LOG_CLASS(LLURLRequest);
public:
+
+ typedef int (* SSLCertVerifyCallback)(X509_STORE_CTX *ctx, void *param);
/**
* @brief This enumeration is for specifying the type of request.
*/
@@ -125,7 +129,7 @@ public:
*
*/
void setURL(const std::string& url);
-
+ std::string getURL() const;
/**
* @brief Add a header to the http post.
*
@@ -143,8 +147,9 @@ public:
* Set whether request will check that remote server
* certificates are signed by a known root CA when using HTTPS.
*/
- void checkRootCertificate(bool check);
+ void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param);
+
/**
* @brief Return at most size bytes of body.
*
@@ -189,6 +194,7 @@ public:
* @brief Give this pipe a chance to handle a generated error
*/
virtual EStatus handleError(EStatus status, LLPumpIO* pump);
+
protected:
/**
@@ -217,6 +223,8 @@ protected:
S32 mRequestTransferedBytes;
S32 mResponseTransferedBytes;
+ static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
+
private:
/**
* @brief Initialize the object. Called during construction.
@@ -364,62 +372,6 @@ protected:
};
-/**
- * @class LLURLRequestClientFactory
- * @brief Template class to build url request based client chains
- *
- * This class eases construction of a basic sd rpc client. Here is an
- * example of it's use:
- * <code>
- * class LLUsefulService : public LLService { ... }<br>
- * LLService::registerCreator(<br>
- * "useful",<br>
- * LLService::creator_t(new LLURLRequestClientFactory<LLUsefulService>))<br>
- * </code>
- *
- * This class should work, but I never got around to using/testing it.
- *
- */
-#if 0
-template<class Client>
-class LLURLRequestClientFactory : public LLChainIOFactory
-{
-public:
- LLURLRequestClientFactory(LLURLRequest::ERequestAction action) {}
- LLURLRequestClientFactory(
- LLURLRequest::ERequestAction action,
- const std::string& fixed_url) :
- mAction(action),
- mURL(fixed_url)
- {
- }
- virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
- {
- lldebugs << "LLURLRequestClientFactory::build" << llendl;
- LLIOPipe::ptr_t service(new Client);
- chain.push_back(service);
- LLURLRequest* http(new LLURLRequest(mAction));
- LLIOPipe::ptr_t http_pipe(http);
- // *FIX: how do we know the content type?
- //http->addHeader("Content-Type: text/llsd");
- if(mURL.empty())
- {
- chain.push_back(LLIOPipe::ptr_t(new LLContextURLExtractor(http)));
- }
- else
- {
- http->setURL(mURL);
- }
- chain.push_back(http_pipe);
- chain.push_back(service);
- return true;
- }
-
-protected:
- LLURLRequest::ERequestAction mAction;
- std::string mURL;
-};
-#endif
/**
* External constants
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 3ecab90756..88a1652671 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -101,6 +101,7 @@ set(llui_SOURCE_FILES
lluictrlfactory.cpp
lluiimage.cpp
lluistring.cpp
+ lluitextutil.cpp
llundo.cpp
llurlaction.cpp
llurlentry.cpp
@@ -197,6 +198,7 @@ set(llui_HEADER_FILES
llui.h
lluiimage.h
lluistring.h
+ lluitextutil.h
llundo.h
llurlaction.h
llurlentry.h
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 596da782ce..0db2dca615 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -32,12 +32,13 @@
#include "linden_common.h"
-#include "lluictrl.h"
-#include "llscrollbar.h"
#include "llaccordionctrltab.h"
-#include "lllocalcliprect.h"
+#include "lllocalcliprect.h"
+#include "llscrollbar.h"
#include "lltextbox.h"
+#include "lluictrl.h"
+#include "lluitextutil.h"
static const std::string DD_BUTTON_NAME = "dd_button";
static const std::string DD_TEXTBOX_NAME = "dd_textbox";
@@ -72,7 +73,8 @@ public:
virtual BOOL postBuild();
- void setTitle(const std::string& title);
+ std::string getTitle();
+ void setTitle(const std::string& title, const std::string& hl);
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
@@ -146,10 +148,28 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild()
return TRUE;
}
-void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title)
+std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle()
{
if(mHeaderTextbox)
- mHeaderTextbox->setText(title);
+ {
+ return mHeaderTextbox->getText();
+ }
+ else
+ {
+ return LLStringUtil::null;
+ }
+}
+
+void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title, const std::string& hl)
+{
+ if(mHeaderTextbox)
+ {
+ LLTextUtil::textboxSetHighlightedVal(
+ mHeaderTextbox,
+ LLStyle::Params(),
+ title,
+ hl);
+ }
}
void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
@@ -436,12 +456,25 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)
addChild(panel,0);
}
-void LLAccordionCtrlTab::setTitle(const std::string& title)
+std::string LLAccordionCtrlTab::getTitle()
+{
+ LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
+ if (header)
+ {
+ return header->getTitle();
+ }
+ else
+ {
+ return LLStringUtil::null;
+ }
+}
+
+void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& hl)
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
{
- header->setTitle(title);
+ header->setTitle(title, hl);
}
}
@@ -903,5 +936,3 @@ BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)
}
return LLUICtrl::handleToolTip(x, y, mask);
}
-
-
diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index de254ed3eb..f5b7fd0af6 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -113,8 +113,10 @@ public:
void setAccordionView(LLView* panel);
LLView* getAccordionView() { return mContainerPanel; };
- // Set text in LLAccordionCtrlTabHeader
- void setTitle(const std::string& title);
+ std::string getTitle();
+
+ // Set text and highlight substring in LLAccordionCtrlTabHeader
+ void setTitle(const std::string& title, const std::string& hl = LLStringUtil::null);
boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb);
boost::signals2::connection setFocusLostCallback(const focus_signal_t::slot_type& cb);
diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp
index 390504234d..6c80275713 100644
--- a/indra/llui/llfiltereditor.cpp
+++ b/indra/llui/llfiltereditor.cpp
@@ -39,6 +39,7 @@
LLFilterEditor::LLFilterEditor(const LLFilterEditor::Params& p)
: LLSearchEditor(p)
{
+ setCommitOnFocusLost(FALSE); // we'll commit on every keystroke, don't re-commit when we take focus away (i.e. we go to interact with the actual results!)
}
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index bea2572ff8..6bd16c9ee6 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -379,6 +379,7 @@ LLFlatListView::LLFlatListView(const LLFlatListView::Params& p)
, mCommitOnSelectionChange(false)
, mPrevNotifyParentRect(LLRect())
, mNoItemsCommentTextbox(NULL)
+ , mIsConsecutiveSelection(false)
{
mBorderThickness = getBorderWidth();
@@ -536,6 +537,7 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
return;
bool grab_items = false;
+ bool reverse = false;
pairs_list_t pairs_to_select;
// Pick out items from list between last selected and current clicked item_pair.
@@ -547,6 +549,8 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
item_pair_t* cur = *iter;
if (cur == last_selected_pair || cur == item_pair)
{
+ // We've got reverse selection if last grabed item isn't a new selection.
+ reverse = grab_items && (cur != item_pair);
grab_items = !grab_items;
// Skip last selected and current clicked item pairs.
continue;
@@ -562,26 +566,35 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
}
}
- if (select_item)
+ if (reverse)
{
- pairs_to_select.push_back(item_pair);
+ pairs_to_select.reverse();
}
+ pairs_to_select.push_back(item_pair);
+
for (pairs_iterator_t
iter = pairs_to_select.begin(),
iter_end = pairs_to_select.end();
iter != iter_end; ++iter)
{
item_pair_t* pair_to_select = *iter;
- selectItemPair(pair_to_select, true);
+ if (isSelected(pair_to_select))
+ {
+ // Item was already selected but there is a need to keep order from last selected pair to new selection.
+ // Do it here to prevent extra mCommitOnSelectionChange in selectItemPair().
+ mSelectedItemPairs.remove(pair_to_select);
+ mSelectedItemPairs.push_back(pair_to_select);
+ }
+ else
+ {
+ selectItemPair(pair_to_select, true);
+ }
}
if (!select_item)
{
- // Item was already selected but there is a need to update last selected item and its border.
- // Do it here to prevent extra mCommitOnSelectionChange in selectItemPair().
- mSelectedItemPairs.remove(item_pair);
- mSelectedItemPairs.push_back(item_pair);
+ // Update last selected item border.
mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
}
return;
@@ -749,6 +762,8 @@ bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select)
// Stretch selected item rect to ensure it won't be clipped
mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
+ // By default mark it as not consecutive selection
+ mIsConsecutiveSelection = false;
return true;
}
@@ -823,6 +838,17 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
if ( 0 == size() )
return false;
+ if (!mIsConsecutiveSelection)
+ {
+ // Leave only one item selected if list has not consecutive selection
+ if (mSelectedItemPairs.size() && !reset_selection)
+ {
+ item_pair_t* cur_sel_pair = mSelectedItemPairs.back();
+ resetSelection();
+ selectItemPair (cur_sel_pair, true);
+ }
+ }
+
if ( mSelectedItemPairs.size() )
{
item_pair_t* to_sel_pair = NULL;
@@ -877,6 +903,8 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
}
// Select/Deselect next item
selectItemPair(select ? to_sel_pair : cur_sel_pair, select);
+ // Mark it as consecutive selection
+ mIsConsecutiveSelection = true;
return true;
}
}
@@ -888,6 +916,8 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
selectLastItem();
else
selectFirstItem();
+ // Mark it as consecutive selection
+ mIsConsecutiveSelection = true;
return true;
}
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 6395805aab..f4e0426f15 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -410,6 +410,8 @@ private:
bool mKeepOneItemSelected;
+ bool mIsConsecutiveSelection;
+
/** All pairs of the list */
pairs_list_t mItemPairs;
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 3375c13c94..fd56a87345 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -41,6 +41,9 @@
#include "lltrans.h"
#include "lluicolortable.h"
+#define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))"
+
+
LLUrlEntryBase::LLUrlEntryBase() :
mColor(LLUIColorTable::instance().getColor("HTMLLinkColor")),
mDisabledLink(false)
@@ -303,10 +306,11 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const
//
// LLUrlEntryAgent Describes a Second Life agent Url, e.g.,
// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
+// x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
//
LLUrlEntryAgent::LLUrlEntryAgent()
{
- mPattern = boost::regex("secondlife:///app/agent/[\\da-f-]+/\\w+",
+ mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_agent.xml";
mIcon = "Generic_Person";
@@ -418,10 +422,11 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
// LLUrlEntryGroup Describes a Second Life group Url, e.g.,
// secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about
// secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
+// x-grid-location-info://lincoln.lindenlab.com/app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
//
LLUrlEntryGroup::LLUrlEntryGroup()
{
- mPattern = boost::regex("secondlife:///app/group/[\\da-f-]+/\\w+",
+ mPattern = boost::regex(APP_HEADER_REGEX "/group/[\\da-f-]+/\\w+",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_group.xml";
mIcon = "Generic_Group";
@@ -482,7 +487,8 @@ LLUrlEntryInventory::LLUrlEntryInventory()
//*TODO: add supporting of inventory item names with whitespaces
//this pattern cann't parse for example
//secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
- mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+\\S*",
+ //x-grid-location-info://lincoln.lindenlab.com/app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
+ mPattern = boost::regex(APP_HEADER_REGEX "/inventory/[\\da-f-]+/\\w+\\S*",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_inventory.xml";
}
@@ -525,10 +531,11 @@ std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
///
/// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
/// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
+/// x-grid-location-info://lincoln.lindenlab.com/app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
///
LLUrlEntryParcel::LLUrlEntryParcel()
{
- mPattern = boost::regex("secondlife:///app/parcel/[\\da-f-]+/about",
+ mPattern = boost::regex(APP_HEADER_REGEX "/parcel/[\\da-f-]+/about",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_parcel.xml";
mTooltip = LLTrans::getString("TooltipParcelUrl");
@@ -544,7 +551,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
//
LLUrlEntryPlace::LLUrlEntryPlace()
{
- mPattern = boost::regex("secondlife://\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
+ mPattern = boost::regex("((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_slurl.xml";
mTooltip = LLTrans::getString("TooltipSLURL");
@@ -589,10 +596,11 @@ std::string LLUrlEntryPlace::getLocation(const std::string &url) const
//
// LLUrlEntryTeleport Describes a Second Life teleport Url, e.g.,
// secondlife:///app/teleport/Ahern/50/50/50/
+// x-grid-location-info://lincoln.lindenlab.com/app/teleport/Ahern/50/50/50/
//
LLUrlEntryTeleport::LLUrlEntryTeleport()
{
- mPattern = boost::regex("secondlife:///app/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
+ mPattern = boost::regex(APP_HEADER_REGEX "/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_teleport.xml";
mTooltip = LLTrans::getString("TooltipTeleportUrl");
@@ -610,7 +618,12 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe
LLURI uri(url);
LLSD path_array = uri.pathArray();
S32 path_parts = path_array.size();
- const std::string label = LLTrans::getString("SLurlLabelTeleport");
+ std::string host = uri.hostName();
+ std::string label = LLTrans::getString("SLurlLabelTeleport");
+ if (!host.empty())
+ {
+ label += " " + host;
+ }
if (path_parts == 6)
{
// handle teleport url with (X,Y,Z) coordinates
@@ -709,7 +722,7 @@ std::string LLUrlEntrySLLabel::getTooltip(const std::string &string) const
//
LLUrlEntryWorldMap::LLUrlEntryWorldMap()
{
- mPattern = boost::regex("secondlife:///app/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
+ mPattern = boost::regex(APP_HEADER_REGEX "/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_map.xml";
mTooltip = LLTrans::getString("TooltipMapUrl");
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index cbb303a059..4463b6cc6f 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -286,6 +286,13 @@ namespace tut
"XXX secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar",
"secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar");
+ testRegex("Standalone Agent Url ", url,
+ "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
+ "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");
+
+ testRegex("Standalone Agent Url Multicase with Text", url,
+ "M x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
+ "x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");
}
template<> template<>
@@ -315,6 +322,15 @@ namespace tut
testRegex("Group Url multicase", url,
"XXX secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About XXX",
"secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About");
+
+ testRegex("Standalone Group Url ", url,
+ "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
+ "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");
+
+ testRegex("Standalone Group Url Multicase ith Text", url,
+ "M x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
+ "x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");
+
}
template<> template<>
@@ -361,7 +377,11 @@ namespace tut
// DEV-35459: SLURLs and teleport Links not parsed properly
testRegex("SLURL with quote", url,
"XXX secondlife://A'ksha%20Oasis/41/166/701 XXX",
- "secondlife://A%27ksha%20Oasis/41/166/701");
+ "secondlife://A%27ksha%20Oasis/41/166/701");
+
+ testRegex("Standalone All Hands (50,50) [2] with text", url,
+ "XXX x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50 XXX",
+ "x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50");
}
template<> template<>
@@ -461,6 +481,10 @@ namespace tut
testRegex("Teleport url with quote", url,
"XXX secondlife:///app/teleport/A'ksha%20Oasis/41/166/701 XXX",
"secondlife:///app/teleport/A%27ksha%20Oasis/41/166/701");
+
+ testRegex("Standalone All Hands", url,
+ "XXX x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50 XXX",
+ "x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50");
}
template<> template<>
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 29b6f490c8..795aa8327d 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -460,7 +460,6 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
}
//llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl;
-
return expanded_filename;
}
@@ -566,27 +565,23 @@ std::string LLDir::getForbiddenFileChars()
return "\\/:*?\"<>|";
}
-void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
+void LLDir::setLindenUserDir(const std::string &username)
{
- // if both first and last aren't set, that's bad.
- if (!first.empty() && !last.empty())
+ // if the username isn't set, that's bad
+ if (!username.empty())
{
// some platforms have case-sensitive filesystems, so be
// utterly consistent with our firstname/lastname case.
- std::string firstlower(first);
- LLStringUtil::toLower(firstlower);
- std::string lastlower(last);
- LLStringUtil::toLower(lastlower);
+ std::string userlower(username);
+ LLStringUtil::toLower(userlower);
+ LLStringUtil::replaceChar(userlower, ' ', '_');
mLindenUserDir = getOSUserAppDir();
mLindenUserDir += mDirDelimiter;
- mLindenUserDir += firstlower;
- mLindenUserDir += "_";
- mLindenUserDir += lastlower;
- llinfos << "Got name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
+ mLindenUserDir += userlower;
}
else
{
- llerrs << "Invalid name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
+ llerrs << "NULL name for LLDir::setLindenUserDir" << llendl;
}
dumpCurrentDirectories();
@@ -604,27 +599,25 @@ void LLDir::setChatLogsDir(const std::string &path)
}
}
-void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last)
+void LLDir::setPerAccountChatLogsDir(const std::string &username)
{
// if both first and last aren't set, assume we're grabbing the cached dir
- if (!first.empty() && !last.empty())
+ if (!username.empty())
{
// some platforms have case-sensitive filesystems, so be
// utterly consistent with our firstname/lastname case.
- std::string firstlower(first);
- LLStringUtil::toLower(firstlower);
- std::string lastlower(last);
- LLStringUtil::toLower(lastlower);
+ std::string userlower(username);
+ LLStringUtil::toLower(userlower);
+ LLStringUtil::replaceChar(userlower, ' ', '_');
mPerAccountChatLogsDir = getChatLogsDir();
mPerAccountChatLogsDir += mDirDelimiter;
- mPerAccountChatLogsDir += firstlower;
- mPerAccountChatLogsDir += "_";
- mPerAccountChatLogsDir += lastlower;
+ mPerAccountChatLogsDir += userlower;
}
else
{
- llwarns << "Invalid name for LLDir::setPerAccountChatLogsDir" << llendl;
+ llerrs << "NULL name for LLDir::setPerAccountChatLogsDir" << llendl;
}
+
}
void LLDir::setSkinFolder(const std::string &skin_folder)
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 9067d75bac..05d5efc66f 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -137,8 +137,8 @@ class LLDir
static std::string getForbiddenFileChars();
virtual void setChatLogsDir(const std::string &path); // Set the chat logs dir to this user's dir
- virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last); // Set the per user chat log directory.
- virtual void setLindenUserDir(const std::string &first, const std::string &last); // Set the linden user dir to this user's dir
+ virtual void setPerAccountChatLogsDir(const std::string &username); // Set the per user chat log directory.
+ virtual void setLindenUserDir(const std::string &username); // Set the linden user dir to this user's dir
virtual void setSkinFolder(const std::string &skin_folder);
virtual bool setCacheDir(const std::string &path);
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index a1e3b679ee..f2bed843c9 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -7,6 +7,7 @@ include(Boost)
include(BuildVersion)
include(DBusGlib)
include(DirectX)
+include(OpenSSL)
include(DragDrop)
include(ELFIO)
include(FMOD)
@@ -254,6 +255,7 @@ set(viewer_SOURCE_FILES
llinventoryclipboard.cpp
llinventoryfilter.cpp
llinventoryfunctions.cpp
+ llinventoryicon.cpp
llinventoryitemslist.cpp
llinventorymodel.cpp
llinventorymodelbackgroundfetch.cpp
@@ -378,6 +380,8 @@ set(viewer_SOURCE_FILES
llscrollingpanelparam.cpp
llsearchcombobox.cpp
llsearchhistory.cpp
+ llsecapi.cpp
+ llsechandler_basic.cpp
llselectmgr.cpp
llsidepanelappearance.cpp
llsidepanelinventory.cpp
@@ -452,7 +456,6 @@ set(viewer_SOURCE_FILES
llurldispatcherlistener.cpp
llurlhistory.cpp
llurllineeditorctrl.cpp
- llurlsimstring.cpp
llurlwhitelist.cpp
llvectorperfoptions.cpp
llversioninfo.cpp
@@ -520,6 +523,7 @@ set(viewer_SOURCE_FILES
llvoicechannel.cpp
llvoiceclient.cpp
llvoicevisualizer.cpp
+ llvoicevivox.cpp
llvoinventorylistener.cpp
llvopartgroup.cpp
llvosky.cpp
@@ -533,9 +537,9 @@ set(viewer_SOURCE_FILES
llwaterparammanager.cpp
llwaterparamset.cpp
llwearable.cpp
- llwearabledictionary.cpp
llwearableitemslist.cpp
llwearablelist.cpp
+ llwearabletype.cpp
llweb.cpp
llwind.cpp
llwlanimator.cpp
@@ -547,6 +551,7 @@ set(viewer_SOURCE_FILES
llworldmapmessage.cpp
llworldmipmap.cpp
llworldmapview.cpp
+ llworldview.cpp
llxmlrpclistener.cpp
llxmlrpctransaction.cpp
noise.cpp
@@ -765,6 +770,7 @@ set(viewer_HEADER_FILES
llinventoryclipboard.h
llinventoryfilter.h
llinventoryfunctions.h
+ llinventoryicon.h
llinventoryitemslist.h
llinventorymodel.h
llinventorymodelbackgroundfetch.h
@@ -887,6 +893,8 @@ set(viewer_HEADER_FILES
llscrollingpanelparam.h
llsearchcombobox.h
llsearchhistory.h
+ llsecapi.h
+ llsechandler_basic.h
llselectmgr.h
llsidepanelappearance.h
llsidepanelinventory.h
@@ -963,7 +971,6 @@ set(viewer_HEADER_FILES
llurldispatcherlistener.h
llurlhistory.h
llurllineeditorctrl.h
- llurlsimstring.h
llurlwhitelist.h
llvectorperfoptions.h
llversioninfo.h
@@ -1028,6 +1035,7 @@ set(viewer_HEADER_FILES
llvoicechannel.h
llvoiceclient.h
llvoicevisualizer.h
+ llvoicevivox.h
llvoinventorylistener.h
llvopartgroup.h
llvosky.h
@@ -1042,9 +1050,9 @@ set(viewer_HEADER_FILES
llwaterparammanager.h
llwaterparamset.h
llwearable.h
- llwearabledictionary.h
llwearableitemslist.h
llwearablelist.h
+ llwearabletype.h
llweb.h
llwind.h
llwindebug.h
@@ -1057,6 +1065,7 @@ set(viewer_HEADER_FILES
llworldmapmessage.h
llworldmipmap.h
llworldmapview.h
+ llworldview.h
llxmlrpclistener.h
llxmlrpctransaction.h
macmain.h
@@ -1422,8 +1431,8 @@ if (WINDOWS)
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
)
- endif(USE_GOOGLE_PERFTOOLS)
-
+ endif(USE_GOOGLE_PERFTOOLS)
+
set(COPY_INPUT_DEPENDENCIES
# The following commented dependencies are determined at variably at build time. Can't do this here.
@@ -1640,6 +1649,8 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${WINDOWS_LIBRARIES}
${XMLRPCEPI_LIBRARIES}
${ELFIO_LIBRARIES}
+ ${OPENSSL_LIBRARIES}
+ ${CRYPTO_LIBRARIES}
${LLLOGIN_LIBRARIES}
${GOOGLE_PERFTOOLS_LIBRARIES}
)
@@ -1816,6 +1827,43 @@ if (LL_TESTS)
"${CMAKE_SOURCE_DIR}/llmessage/tests/test_llsdmessage_peer.py"
)
+ set(test_libs
+ ${LLMESSAGE_LIBRARIES}
+ ${WINDOWS_LIBRARIES}
+ ${LLVFS_LIBRARIES}
+ ${LLMATH_LIBRARIES}
+ ${LLCOMMON_LIBRARIES}
+ ${GOOGLEMOCK_LIBRARIES}
+ ${OPENSSL_LIBRARIES}
+ ${CRYPTO_LIBRARIES}
+ )
+
+ LL_ADD_INTEGRATION_TEST(llsechandler_basic
+ llsechandler_basic.cpp
+ "${test_libs}"
+ )
+
+ LL_ADD_INTEGRATION_TEST(llsecapi
+ llsecapi.cpp
+ "${test_libs}"
+ )
+
+ set(llslurl_test_sources
+ llslurl.cpp
+ llviewernetwork.cpp
+ )
+
+
+ LL_ADD_INTEGRATION_TEST(llslurl
+ "${llslurl_test_sources}"
+ "${test_libs}"
+ )
+
+ LL_ADD_INTEGRATION_TEST(llviewernetwork
+ llviewernetwork.cpp
+ "${test_libs}"
+ )
+
#ADD_VIEWER_BUILD_TEST(llmemoryview viewer)
#ADD_VIEWER_BUILD_TEST(llagentaccess viewer)
#ADD_VIEWER_BUILD_TEST(llworldmap viewer)
@@ -1823,6 +1871,7 @@ if (LL_TESTS)
#ADD_VIEWER_BUILD_TEST(lltextureinfo viewer)
#ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer)
#ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer)
+
endif (LL_TESTS)
diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist
index a7241cac89..fa2adac10c 100644
--- a/indra/newview/Info-SecondLife.plist
+++ b/indra/newview/Info-SecondLife.plist
@@ -18,6 +18,33 @@
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>slurl</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>seconlife</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>application/x-grid-location-info</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Secondlife SLURL</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>SLRL</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <true/>
+ <key>NSDocumentClass</key>
+ <string>SecondLifeSLURL</string>
+ </dict>
+ </array>
<key>CFBundleURLTypes</key>
<array>
<dict>
@@ -26,6 +53,7 @@
<key>CFBundleURLSchemes</key>
<array>
<string>secondlife</string>
+ <string>x-grid-location-info</string>
</array>
<key>LSIsAppleDefaultForScheme</key>
<true/>
diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini
index 0805e94b10..263b73ba23 100644
--- a/indra/newview/app_settings/keywords.ini
+++ b/indra/newview/app_settings/keywords.ini
@@ -497,6 +497,7 @@ PARCEL_DETAILS_DESC Used with llGetParcelDetails to get the parcel description.
PARCEL_DETAILS_OWNER Used with llGetParcelDetails to get the parcel owner id.
PARCEL_DETAILS_GROUP Used with llGetParcelDetails to get the parcel group id.
PARCEL_DETAILS_AREA Used with llGetParcelDetails to get the parcel area in square meters.
+PARCEL_DETAILS_ID Used with llGetParcelDetails to get the parcel id.
STRING_TRIM_HEAD Used with llStringTrim to trim leading spaces from a string.
STRING_TRIM_TAIL Used with llStringTrim to trim trailing spaces from a string.
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 65cd91e770..4e4c0274e7 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1265,6 +1265,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>CertStore</key>
+ <map>
+ <key>Comment</key>
+ <string>Specifies the Certificate Store for certificate trust verification</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>default</string>
+ </map>
<key>ChatBarStealsFocus</key>
<map>
<key>Comment</key>
@@ -1641,6 +1652,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>CurrentGrid</key>
+ <map>
+ <key>Comment</key>
+ <string>Currently Selected Grid</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string></string>
+ </map>
<key>CustomServer</key>
<map>
<key>Comment</key>
@@ -1652,6 +1674,17 @@
<key>Value</key>
<string />
</map>
+ <key>DebugAvatarRezTime</key>
+ <map>
+ <key>Comment</key>
+ <string>Display times for avatars to resolve.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>DebugBeaconLineWidth</key>
<map>
<key>Comment</key>
@@ -2367,6 +2400,29 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>DefaultFemaleAvatar</key>
+ <map>
+ <key>Comment</key>
+ <string>Default Female Avatar</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>Female Shape &amp; Outfit</string>
+ </map>
+ <key>DefaultMaleAvatar</key>
+ <map>
+ <key>Comment</key>
+ <string>Default Male Avatar</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>Male Shape &amp; Outfit</string>
+ </map>
+
<key>DefaultObjectTexture</key>
<map>
<key>Comment</key>
@@ -3808,6 +3864,17 @@
<key>Value</key>
<real>1.0</real>
</map>
+ <key>InventoryLinking</key>
+ <map>
+ <key>Comment</key>
+ <string>Enable ability to create links to folders and items via "Paste as link".</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>InventorySortOrder</key>
<map>
<key>Comment</key>
@@ -4436,6 +4503,17 @@
<key>Value</key>
<real>128.0</real>
</map>
+ <key>MapServerURL</key>
+ <map>
+ <key>Comment</key>
+ <string>World map URL template for locating map tiles</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>http://map.secondlife.com.s3.amazonaws.com/</string>
+ </map>
<key>MapShowEvents</key>
<map>
<key>Comment</key>
@@ -7765,6 +7843,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>SecondLifeEnterprise</key>
+ <map>
+ <key>Comment</key>
+ <string>Enables Second Life Enterprise features</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>SelectMovableOnly</key>
<map>
<key>Comment</key>
@@ -7974,6 +8063,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>ShowBetaGrids</key>
+ <map>
+ <key>Comment</key>
+ <string>Display the beta grids in the grid selection control.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>ShowCrosshairs</key>
<map>
<key>Comment</key>
@@ -8128,6 +8228,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>SidebarCameraMovement</key>
+ <map>
+ <key>Comment</key>
+ <string>Reflects world rect changing while changing sidebar visibility.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>GroupListShowIcons</key>
<map>
<key>Comment</key>
@@ -10429,6 +10540,17 @@
<key>Value</key>
<string></string>
</map>
+ <key>VivoxDebugSIPURIHostName</key>
+ <map>
+ <key>Comment</key>
+ <string>Hostname portion of vivox SIP URIs (empty string for the default).</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string></string>
+ </map>
<key>VivoxDebugVoiceAccountServerURI</key>
<map>
<key>Comment</key>
@@ -10440,6 +10562,28 @@
<key>Value</key>
<string></string>
</map>
+ <key>VivoxVoiceHost</key>
+ <map>
+ <key>Comment</key>
+ <string>Client SLVoice host to connect to</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>127.0.0.1</string>
+ </map>
+ <key>VivoxVoicePort</key>
+ <map>
+ <key>Comment</key>
+ <string>Client SLVoice port to connect to</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <integer>44125</integer>
+ </map>
<key>VoiceCallsFriendsOnly</key>
<map>
<key>Comment</key>
@@ -10572,6 +10716,17 @@
<key>Value</key>
<string>Default</string>
</map>
+ <key>VoiceLogFile</key>
+ <map>
+ <key>Comment</key>
+ <string>Log file to use when launching the voice daemon</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string></string>
+ </map>
<key>VoiceOutputAudioDevice</key>
<map>
<key>Comment</key>
@@ -10616,6 +10771,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>VoiceServerType</key>
+ <map>
+ <key>Comment</key>
+ <string>The type of voice server to connect to.</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>vivox</string>
+ </map>
<key>WLSkyDetail</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index 4029bf95a0..5f31ccbb19 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -296,28 +296,23 @@ RenderUseImpostors 0 0
list Intel_945GM
RenderTerrainDetail 1 0
RenderVBOEnable 1 0
-RenderUseImpostors 0 0
list Intel_945G
RenderTerrainDetail 1 0
RenderVBOEnable 1 0
-RenderUseImpostors 0 0
list Intel_950
RenderTerrainDetail 1 0
RenderVBOEnable 1 0
-RenderUseImpostors 0 0
list Intel_965
RenderTerrainDetail 1 0
RenderVBOEnable 1 0
UseOcclusion 0 0
-RenderUseImpostors 0 0
list Intel_G33
RenderTerrainDetail 1 0
RenderVBOEnable 1 0
-RenderUseImpostors 0 0
list Intel_G45
WindLightUseAtmosShaders 0 0
diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt
index aa0e21ea8f..3754f30a66 100644
--- a/indra/newview/gpu_table.txt
+++ b/indra/newview/gpu_table.txt
@@ -70,43 +70,42 @@ ATI M56 .*ATI.*M56.* 1 1
ATI M71 .*ATI.*M71.* 1 1
ATI M72 .*ATI.*M72.* 1 1
ATI M76 .*ATI.*M76.* 3 1
-ATI Mobility Radeon 7xxx .*ATI.*Mobility.*Radeon 7.* 0 1
-ATI Mobility Radeon 8xxx .*ATI.*Mobility.*Radeon 8.* 0 1
-ATI Mobility Radeon 9800 .*ATI.*Mobility.*98.* 0 1
-ATI Mobility Radeon 9700 .*ATI.*Mobility.*97.* 0 1
-ATI Mobility Radeon 9600 .*ATI.*Mobility.*96.* 0 1
-ATI Mobility Radeon HD 2300 .*ATI.*Mobility.*HD.*23.* 1 1
-ATI Mobility Radeon HD 2400 .*ATI.*Mobility.*HD.*24.* 1 1
-ATI Mobility Radeon HD 2600 .*ATI.*Mobility.*HD.*26.* 3 1
-ATI Mobility Radeon HD 3400 .*ATI.*Mobility.*HD.*34.* 1 1
-ATI Mobility Radeon HD 3600 .*ATI.*Mobility.*HD.*36.* 3 1
-ATI Mobility Radeon HD 3800 .*ATI.*Mobility.*HD.*38.* 3 1
-ATI Mobility Radeon X1xxx .*ATI.*Mobility.*X1.* 0 1
-ATI Mobility Radeon X2xxx .*ATI.*Mobility.*X2.* 0 1
-ATI Mobility Radeon X3xx .*ATI.*Mobility.*X3.* 1 1
-ATI Mobility Radeon X6xx .*ATI.*Mobility.*X6.* 1 1
-ATI Mobility Radeon X7xx .*ATI.*Mobility.*X7.* 1 1
-ATI Mobility Radeon Xxxx .*ATI.*Mobility.*X.* 0 1
-ATI Mobility Radeon .*ATI.*Mobility.* 0 1
-ATI Radeon HD 2300 .*ATI.*Radeon HD 23.* 0 1
-ATI Radeon HD 2400 .*ATI.*Radeon HD.*24.* 1 1
-ATI Radeon HD 2600 .*ATI.*Radeon HD 26.* 2 1
-ATI Radeon HD 2900 .*ATI.*Radeon HD 29.* 3 1
-ATI Radeon HD 3200 .*ATI.*Radeon.*HD.*32.* 1 1
-ATI Radeon HD 3300 .*ATI.*Radeon HD.*33.* 1 1
-ATI Radeon HD 3400 .*ATI.*Radeon HD.*34.* 1 1
-ATI Radeon HD 3600 .*ATI.*Radeon HD.*36.* 3 1
-ATI Radeon HD 3800 .*ATI.*Radeon HD.*38.* 3 1
-ATI Radeon HD 4200 .*ATI.*Radeon HD 42.* 1 1
-ATI Radeon HD 4300 .*ATI.*Radeon HD 43.* 1 1
-ATI Radeon HD 4500 .*ATI.*Radeon HD 45.* 3 1
-ATI Radeon HD 4600 .*ATI.*Radeon HD.*46.* 3 1
-ATI Radeon HD 4700 .*ATI.*Radeon HD 47.* 3 1
-ATI Radeon HD 4800 .*ATI.*Radeon.*HD.*48.* 3 1
-ATI Radeon HD 5600 .*ATI.*Radeon.*HD.*56.* 3 1
-ATI Radeon HD 5700 .*ATI.*Radeon.*HD.*57.* 3 1
-ATI Radeon HD 5800 .*ATI.*Radeon.*HD.*58.* 3 1
-ATI Radeon HD 5900 .*ATI.*Radeon.*HD.*59.* 3 1
+ATI Mobility Radeon 7xxx .*ATI.*Mobility *Radeon 7.* 0 1
+ATI Mobility Radeon 8xxx .*ATI.*Mobility *Radeon 8.* 0 1
+ATI Mobility Radeon 9800 .*ATI.*Mobility *98.* 0 1
+ATI Mobility Radeon 9700 .*ATI.*Mobility *97.* 0 1
+ATI Mobility Radeon 9600 .*ATI.*Mobility *96.* 0 1
+ATI Mobility Radeon HD 2300 .*ATI.*Mobility *HD *23.* 1 1
+ATI Mobility Radeon HD 2400 .*ATI.*Mobility *HD *24.* 1 1
+ATI Mobility Radeon HD 2600 .*ATI.*Mobility *HD *26.* 3 1
+ATI Mobility Radeon HD 3400 .*ATI.*Mobility *HD *34.* 1 1
+ATI Mobility Radeon HD 3600 .*ATI.*Mobility *HD *36.* 3 1
+ATI Mobility Radeon HD 3800 .*ATI.*Mobility *HD *38.* 3 1
+ATI Mobility Radeon X1xxx .*ATI.*Mobility *X1.* 0 1
+ATI Mobility Radeon X2xxx .*ATI.*Mobility *X2.* 0 1
+ATI Mobility Radeon X3xx .*ATI.*Mobility *X3.* 1 1
+ATI Mobility Radeon X6xx .*ATI.*Mobility *X6.* 1 1
+ATI Mobility Radeon X7xx .*ATI.*Mobility *X7.* 1 1
+ATI Mobility Radeon Xxxx .*ATI.*Mobility *X.* 0 1
+ATI Radeon HD 2300 .*ATI.*Radeon HD *23.* 0 1
+ATI Radeon HD 2400 .*ATI.*Radeon HD *24.* 1 1
+ATI Radeon HD 2600 .*ATI.*Radeon HD *26.* 2 1
+ATI Radeon HD 2900 .*ATI.*Radeon HD *29.* 3 1
+ATI Radeon HD 3200 .*ATI.*Radeon *HD *32.* 0 1
+ATI Radeon HD 3300 .*ATI.*Radeon HD *33.* 1 1
+ATI Radeon HD 3400 .*ATI.*Radeon HD *34.* 1 1
+ATI Radeon HD 3600 .*ATI.*Radeon HD *36.* 3 1
+ATI Radeon HD 3800 .*ATI.*Radeon HD *38.* 3 1
+ATI Radeon HD 4200 .*ATI.*Radeon HD *42.* 1 1
+ATI Radeon HD 4300 .*ATI.*Radeon HD *43.* 1 1
+ATI Radeon HD 4500 .*ATI.*Radeon HD *45.* 3 1
+ATI Radeon HD 4600 .*ATI.*Radeon HD *46.* 3 1
+ATI Radeon HD 4700 .*ATI.*Radeon HD *47.* 3 1
+ATI Radeon HD 4800 .*ATI.*Radeon.*HD *48.* 3 1
+ATI Radeon HD 5600 .*ATI.*Radeon.*HD *56.* 3 1
+ATI Radeon HD 5700 .*ATI.*Radeon.*HD *57.* 3 1
+ATI Radeon HD 5800 .*ATI.*Radeon.*HD *58.* 3 1
+ATI Radeon HD 5900 .*ATI.*Radeon.*HD *59.* 3 1
ATI Radeon OpenGL .*ATI.*Radeon OpenGL.* 0 0
ATI Radeon 2100 .*ATI.*Radeon 21.* 0 1
ATI Radeon 3100 .*ATI.*Radeon 31.* 1 1
@@ -128,12 +127,12 @@ ATI Radeon VE .*ATI.*Radeon.*VE.* 0 0
ATI Radeon X1000 .*ATI.*Radeon *X10.* 0 1
ATI Radeon X1200 .*ATI.*Radeon *X12.* 0 1
ATI Radeon X1300 .*ATI.*Radeon *X13.* 1 1
-ATI Radeon X1400 .*ATI.*Radeon X14.* 1 1
-ATI Radeon X1500 .*ATI.*Radeon X15.* 1 1
+ATI Radeon X1400 .*ATI.*Radeon *X14.* 1 1
+ATI Radeon X1500 .*ATI.*Radeon *X15.* 1 1
ATI Radeon X1600 .*ATI.*Radeon *X16.* 1 1
-ATI Radeon X1700 .*ATI.*Radeon X17.* 1 1
-ATI Radeon X1800 .*ATI.*Radeon X18.* 3 1
-ATI Radeon X1900 .*ATI.*Radeon X19.* 3 1
+ATI Radeon X1700 .*ATI.*Radeon *X17.* 1 1
+ATI Radeon X1800 .*ATI.*Radeon *X18.* 3 1
+ATI Radeon X1900 .*ATI.*Radeon *X19.* 3 1
ATI Radeon X300 .*ATI.*Radeon *X3.* 0 1
ATI Radeon X400 .*ATI.*Radeon X4.* 0 1
ATI Radeon X500 .*ATI.*Radeon X5.* 0 1
diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi
index a7322749ca..b7b4c54001 100644
--- a/indra/newview/installers/windows/installer_template.nsi
+++ b/indra/newview/installers/windows/installer_template.nsi
@@ -797,6 +797,12 @@ WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
;; URL param must be last item passed to viewer, it ignores subsequent params
;; to avoid parameter injection attacks.
WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
+WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info"(default)" "URL:Second Life"
+WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "URL Protocol" ""
+WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
+;; URL param must be last item passed to viewer, it ignores subsequent params
+;; to avoid parameter injection attacks.
+WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
; write out uninstaller
WriteUninstaller "$INSTDIR\uninst.exe"
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index ddcaeb113d..529ce950e4 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -1495,6 +1495,8 @@ void LLAgent::propagate(const F32 dt)
floater_move->mBackwardButton ->setToggleState( gAgentCamera.getAtKey() < 0 || gAgentCamera.getWalkKey() < 0 );
floater_move->mTurnLeftButton ->setToggleState( gAgentCamera.getYawKey() > 0.f );
floater_move->mTurnRightButton ->setToggleState( gAgentCamera.getYawKey() < 0.f );
+ floater_move->mSlideLeftButton ->setToggleState( gAgentCamera.getLeftKey() > 0.f );
+ floater_move->mSlideRightButton ->setToggleState( gAgentCamera.getLeftKey() < 0.f );
floater_move->mMoveUpButton ->setToggleState( gAgentCamera.getUpKey() > 0 );
floater_move->mMoveDownButton ->setToggleState( gAgentCamera.getUpKey() < 0 );
}
@@ -3236,7 +3238,7 @@ bool LLAgent::teleportCore(bool is_local)
// MBW -- Let the voice client know a teleport has begun so it can leave the existing channel.
// This was breaking the case of teleporting within a single sim. Backing it out for now.
-// gVoiceClient->leaveChannel();
+// LLVoiceClient::getInstance()->leaveChannel();
return true;
}
@@ -3380,7 +3382,7 @@ void LLAgent::setTeleportState(ETeleportState state)
if (mTeleportState == TELEPORT_MOVING)
{
// We're outa here. Save "back" slurl.
- mTeleportSourceSLURL = LLAgentUI::buildSLURL();
+ LLAgentUI::buildSLURL(mTeleportSourceSLURL);
}
else if(mTeleportState == TELEPORT_ARRIVING)
{
@@ -3556,7 +3558,7 @@ void LLAgent::sendAgentSetAppearance()
const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
// if we're not wearing a skirt, we don't need the texture to be baked
- if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT))
+ if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
{
continue;
}
@@ -3579,8 +3581,8 @@ void LLAgent::sendAgentSetAppearance()
LLUUID hash;
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
{
- // EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num];
- const EWearableType wearable_type = baked_dict->mWearables[i];
+ // LLWearableType::EType wearable_type = gBakedWearableMap[baked_index][wearable_num];
+ const LLWearableType::EType wearable_type = baked_dict->mWearables[i];
// MULTI-WEARABLE: fixed to 0th - extend to everything once messaging works.
const LLWearable* wearable = gAgentWearables.getWearable(wearable_type,0);
if (wearable)
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index a460077b7e..32f9b00135 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -42,6 +42,7 @@
#include "llpointer.h"
#include "lluicolor.h"
#include "llvoavatardefines.h"
+#include "llslurl.h"
extern const BOOL ANIMATE;
extern const U8 AGENT_STATE_TYPING; // Typing indication
@@ -514,13 +515,13 @@ public:
public:
static void parseTeleportMessages(const std::string& xml_filename);
- const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; }
+ const void getTeleportSourceSLURL(LLSLURL& slurl) const { slurl = mTeleportSourceSLURL; }
public:
// ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings.
static std::map<std::string, std::string> sTeleportErrorMessages;
static std::map<std::string, std::string> sTeleportProgressMessages;
private:
- std::string mTeleportSourceSLURL; // SLURL where last TP began
+ LLSLURL mTeleportSourceSLURL; // SLURL where last TP began
//--------------------------------------------------------------------
// Teleport Actions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index b3ed7c353e..7a8205acb5 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -53,7 +53,10 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
}
else
{
- std::string url = LLSLURL::buildSLURL(event_data["regionname"], event_data["x"], event_data["y"], event_data["z"]);
+ std::string url = LLSLURL(event_data["regionname"],
+ LLVector3(event_data["x"].asReal(),
+ event_data["y"].asReal(),
+ event_data["z"].asReal())).getSLURLString();
LLURLDispatcher::dispatch(url, NULL, false);
}
}
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index c4597ad6f8..15d9f36b74 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -76,16 +76,15 @@ void LLAgentUI::buildFullname(std::string& name)
}
//static
-std::string LLAgentUI::buildSLURL(const bool escaped /*= true*/)
+void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/)
{
- std::string slurl;
- LLViewerRegion *regionp = gAgent.getRegion();
- if (regionp)
- {
- LLVector3d agentPos = gAgent.getPositionGlobal();
- slurl = LLSLURL::buildSLURLfromPosGlobal(regionp->getName(), agentPos, escaped);
- }
- return slurl;
+ LLSLURL return_slurl;
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
+ }
+ slurl = return_slurl;
}
//static
diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h
index 3478793e38..577b752fbe 100644
--- a/indra/newview/llagentui.h
+++ b/indra/newview/llagentui.h
@@ -33,6 +33,8 @@
#ifndef LLAGENTUI_H
#define LLAGENTUI_H
+class LLSLURL;
+
class LLAgentUI
{
public:
@@ -48,7 +50,7 @@ public:
static void buildName(std::string& name);
static void buildFullname(std::string &name);
- static std::string buildSLURL(const bool escaped = true);
+ static void buildSLURL(LLSLURL& slurl, const bool escaped = true);
//build location string using the current position of gAgent.
static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK);
//build location string using a region position of the avatar.
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index b5fde0baca..3e73bbef15 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -100,13 +100,13 @@ void checkWearableAgainstInventory(LLWearable *wearable)
void LLAgentWearables::dump()
{
llinfos << "LLAgentWearablesDump" << llendl;
- for (S32 i = 0; i < WT_COUNT; i++)
+ for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
{
- U32 count = getWearableCount((EWearableType)i);
+ U32 count = getWearableCount((LLWearableType::EType)i);
llinfos << "Type: " << i << " count " << count << llendl;
for (U32 j=0; j<count; j++)
{
- LLWearable* wearable = getWearable((EWearableType)i,j);
+ LLWearable* wearable = getWearable((LLWearableType::EType)i,j);
if (wearable == NULL)
{
llinfos << " " << j << " NULL wearable" << llendl;
@@ -250,7 +250,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const S32 type,
if (item_id.isNull())
return;
- LLUUID old_item_id = getWearableItemID((EWearableType)type,index);
+ LLUUID old_item_id = getWearableItemID((LLWearableType::EType)type,index);
if (wearable)
{
@@ -259,11 +259,11 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const S32 type,
if (old_item_id.notNull())
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
- setWearable((EWearableType)type,index,wearable);
+ setWearable((LLWearableType::EType)type,index,wearable);
}
else
{
- pushWearable((EWearableType)type,wearable);
+ pushWearable((LLWearableType::EType)type,wearable);
}
}
@@ -287,11 +287,11 @@ void LLAgentWearables::sendAgentWearablesUpdate()
{
// MULTI-WEARABLE: call i "type" or something.
// First make sure that we have inventory items for each wearable
- for (S32 type=0; type < WT_COUNT; ++type)
+ for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
{
- for (U32 j=0; j < getWearableCount((EWearableType)type); ++j)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)type); ++j)
{
- LLWearable* wearable = getWearable((EWearableType)type,j);
+ LLWearable* wearable = getWearable((LLWearableType::EType)type,j);
if (wearable)
{
if (wearable->getItemID().isNull())
@@ -326,7 +326,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
lldebugs << "sendAgentWearablesUpdate()" << llendl;
// MULTI-WEARABLE: update for multi-wearables after server-side support is in.
- for (S32 type=0; type < WT_COUNT; ++type)
+ for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
{
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
@@ -334,7 +334,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8);
// MULTI-WEARABLE: TODO: hacked index to 0, needs to loop over all once messages support this.
- LLWearable* wearable = getWearable((EWearableType)type, 0);
+ LLWearable* wearable = getWearable((LLWearableType::EType)type, 0);
if (wearable)
{
//llinfos << "Sending wearable " << wearable->getName() << llendl;
@@ -350,16 +350,16 @@ void LLAgentWearables::sendAgentWearablesUpdate()
}
else
{
- //llinfos << "Not wearing wearable type " << LLWearableDictionary::getInstance()->getWearable((EWearableType)i) << llendl;
+ //llinfos << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << llendl;
gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
}
- lldebugs << " " << LLWearableDictionary::getTypeLabel((EWearableType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
+ lldebugs << " " << LLWearableType::getTypeLabel((LLWearableType::EType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
}
gAgent.sendReliableMessage();
}
-void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, BOOL send_update)
+void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update)
{
LLWearable* old_wearable = getWearable(type, index);
if (old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion()))
@@ -422,7 +422,7 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B
}
}
-void LLAgentWearables::saveWearableAs(const EWearableType type,
+void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
const U32 index,
const std::string& new_name,
BOOL save_in_lost_and_found)
@@ -483,7 +483,7 @@ void LLAgentWearables::saveWearableAs(const EWearableType type,
old_wearable->revertValues();
}
-void LLAgentWearables::revertWearable(const EWearableType type, const U32 index)
+void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
{
LLWearable* wearable = getWearable(type, index);
wearable->revertValues();
@@ -498,10 +498,10 @@ void LLAgentWearables::saveAllWearables()
// return;
//}
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
- saveWearable((EWearableType)i, j, FALSE);
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+ saveWearable((LLWearableType::EType)i, j, FALSE);
}
sendAgentWearablesUpdate();
}
@@ -509,14 +509,14 @@ void LLAgentWearables::saveAllWearables()
// Called when the user changes the name of a wearable inventory item that is currently being worn.
void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name)
{
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLUUID curr_item_id = getWearableItemID((EWearableType)i,j);
+ LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
if (curr_item_id == item_id)
{
- LLWearable* old_wearable = getWearable((EWearableType)i,j);
+ LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
llassert(old_wearable);
std::string old_name = old_wearable->getName();
@@ -530,7 +530,7 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
}
old_wearable->setName(old_name);
- setWearable((EWearableType)i,j,new_wearable);
+ setWearable((LLWearableType::EType)i,j,new_wearable);
sendAgentWearablesUpdate();
break;
}
@@ -539,7 +539,7 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
}
-BOOL LLAgentWearables::isWearableModifiable(EWearableType type, U32 index) const
+BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
{
LLUUID item_id = getWearableItemID(type, index);
if (!item_id.isNull())
@@ -554,7 +554,7 @@ BOOL LLAgentWearables::isWearableModifiable(EWearableType type, U32 index) const
return FALSE;
}
-BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const
+BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const
{
LLUUID item_id = getWearableItemID(type, index);
if (!item_id.isNull())
@@ -570,7 +570,7 @@ BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const
}
/*
- U32 LLAgentWearables::getWearablePermMask(EWearableType type)
+ U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type)
{
LLUUID item_id = getWearableItemID(type);
if (!item_id.isNull())
@@ -585,7 +585,7 @@ BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const
}
*/
-LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type, U32 index)
+LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index)
{
LLUUID item_id = getWearableItemID(type,index);
LLInventoryItem* item = NULL;
@@ -598,11 +598,11 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type,
const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
{
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- const LLWearable * curr_wearable = getWearable((EWearableType)i, j);
+ const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == item_id))
{
return curr_wearable;
@@ -614,11 +614,11 @@ const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
{
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLWearable * curr_wearable = getWearable((EWearableType)i, j);
+ LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
{
return curr_wearable;
@@ -638,12 +638,12 @@ void LLAgentWearables::sendAgentWearablesRequest()
}
// static
-BOOL LLAgentWearables::selfHasWearable(EWearableType type)
+BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
{
return (gAgentWearables.getWearableCount(type) > 0);
}
-LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index)
+LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
{
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -661,7 +661,7 @@ LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index)
}
}
-void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearable *wearable)
+void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
{
LLWearable *old_wearable = getWearable(type,index);
@@ -691,7 +691,7 @@ void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearab
}
}
-U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearable)
+U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable *wearable)
{
if (wearable == NULL)
{
@@ -699,7 +699,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
llwarns << "Null wearable sent for type " << type << llendl;
return MAX_WEARABLES_PER_TYPE;
}
- if (type < WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE)
+ if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE)
{
mWearableDatas[type].push_back(wearable);
wearableUpdated(wearable);
@@ -741,7 +741,7 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
}
U32 index = getWearableIndex(wearable);
- EWearableType type = wearable->getType();
+ LLWearableType::EType type = wearable->getType();
if (index < MAX_WEARABLES_PER_TYPE && index < getWearableCount(type))
{
@@ -749,7 +749,7 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
}
}
-void LLAgentWearables::popWearable(const EWearableType type, U32 index)
+void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
{
LLWearable *wearable = getWearable(type, index);
if (wearable)
@@ -767,7 +767,7 @@ U32 LLAgentWearables::getWearableIndex(LLWearable *wearable)
return MAX_WEARABLES_PER_TYPE;
}
- const EWearableType type = wearable->getType();
+ const LLWearableType::EType type = wearable->getType();
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
{
@@ -786,7 +786,7 @@ U32 LLAgentWearables::getWearableIndex(LLWearable *wearable)
return MAX_WEARABLES_PER_TYPE;
}
-const LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index) const
+const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
{
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -804,7 +804,7 @@ const LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 in
}
}
-LLWearable* LLAgentWearables::getTopWearable(const EWearableType type)
+LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
{
U32 count = getWearableCount(type);
if ( count == 0)
@@ -815,7 +815,7 @@ LLWearable* LLAgentWearables::getTopWearable(const EWearableType type)
return getWearable(type, count-1);
}
-U32 LLAgentWearables::getWearableCount(const EWearableType type) const
+U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
{
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -828,7 +828,7 @@ U32 LLAgentWearables::getWearableCount(const EWearableType type) const
U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
{
- const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
+ const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
return getWearableCount(wearable_type);
}
@@ -843,7 +843,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const
return mItemsAwaitingWearableUpdate.size();
}
-const LLUUID LLAgentWearables::getWearableItemID(EWearableType type, U32 index) const
+const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
{
const LLWearable *wearable = getWearable(type,index);
if (wearable)
@@ -852,7 +852,7 @@ const LLUUID LLAgentWearables::getWearableItemID(EWearableType type, U32 index)
return LLUUID();
}
-const LLUUID LLAgentWearables::getWearableAssetID(EWearableType type, U32 index) const
+const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
{
const LLWearable *wearable = getWearable(type,index);
if (wearable)
@@ -916,11 +916,11 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
// Parse initial wearables data from message system
U8 type_u8 = 0;
gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i);
- if (type_u8 >= WT_COUNT)
+ if (type_u8 >= LLWearableType::WT_COUNT)
{
continue;
}
- const EWearableType type = (EWearableType) type_u8;
+ const LLWearableType::EType type = (LLWearableType::EType) type_u8;
LLUUID item_id;
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i);
@@ -933,7 +933,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
}
else
{
- LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(type);
+ LLAssetType::EType asset_type = LLWearableType::getAssetType(type);
if (asset_type == LLAssetType::AT_NONE)
{
continue;
@@ -946,7 +946,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
outfit->add(wearable_data);
}
- lldebugs << " " << LLWearableDictionary::getTypeLabel(type) << llendl;
+ lldebugs << " " << LLWearableType::getTypeLabel(type) << llendl;
}
// Get the complete information on the items in the inventory and set up an observer
@@ -970,11 +970,11 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
// Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the
// database. If for some reason, we can't load one of those assets, we can try to reconstruct it so that
// the user isn't left without a shape, for example. (We can do that only after the inventory has loaded.)
-void LLAgentWearables::recoverMissingWearable(const EWearableType type, U32 index)
+void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, U32 index)
{
// Try to recover by replacing missing wearable with a new one.
LLNotificationsUtil::add("ReplacedMissingWearable");
- lldebugs << "Wearable " << LLWearableDictionary::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
+ lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type);
S32 type_s32 = (S32) type;
@@ -1011,9 +1011,9 @@ void LLAgentWearables::recoverMissingWearableDone()
}
}
-void LLAgentWearables::addLocalTextureObject(const EWearableType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
+void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
{
- LLWearable* wearable = getWearable((EWearableType)wearable_type, wearable_index);
+ LLWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index);
if (!wearable)
{
llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
@@ -1027,7 +1027,7 @@ class OnWearableItemCreatedCB: public LLInventoryCallback
{
public:
OnWearableItemCreatedCB():
- mWearablesAwaitingItems(WT_COUNT,NULL)
+ mWearablesAwaitingItems(LLWearableType::WT_COUNT,NULL)
{
llinfos << "created callback" << llendl;
}
@@ -1053,8 +1053,8 @@ public:
llwarns << "no wearable" << llendl;
return;
}
- EWearableType type = wearable->getType();
- if (type<WT_COUNT)
+ LLWearableType::EType type = wearable->getType();
+ if (type<LLWearableType::WT_COUNT)
{
mWearablesAwaitingItems[type] = wearable;
}
@@ -1078,8 +1078,8 @@ public:
}
if (item && item->isWearableType())
{
- EWearableType type = item->getWearableType();
- if (type < WT_COUNT)
+ LLWearableType::EType type = item->getWearableType();
+ if (type < LLWearableType::WT_COUNT)
{
LLWearable *wearable = mWearablesAwaitingItems[type];
if (wearable)
@@ -1106,30 +1106,30 @@ void LLAgentWearables::createStandardWearables(BOOL female)
gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
- const BOOL create[WT_COUNT] =
+ const BOOL create[LLWearableType::WT_COUNT] =
{
- TRUE, //WT_SHAPE
- TRUE, //WT_SKIN
- TRUE, //WT_HAIR
- TRUE, //WT_EYES
- TRUE, //WT_SHIRT
- TRUE, //WT_PANTS
- TRUE, //WT_SHOES
- TRUE, //WT_SOCKS
- FALSE, //WT_JACKET
- FALSE, //WT_GLOVES
- TRUE, //WT_UNDERSHIRT
- TRUE, //WT_UNDERPANTS
- FALSE //WT_SKIRT
+ TRUE, //LLWearableType::WT_SHAPE
+ TRUE, //LLWearableType::WT_SKIN
+ TRUE, //LLWearableType::WT_HAIR
+ TRUE, //LLWearableType::WT_EYES
+ TRUE, //LLWearableType::WT_SHIRT
+ TRUE, //LLWearableType::WT_PANTS
+ TRUE, //LLWearableType::WT_SHOES
+ TRUE, //LLWearableType::WT_SOCKS
+ FALSE, //LLWearableType::WT_JACKET
+ FALSE, //LLWearableType::WT_GLOVES
+ TRUE, //LLWearableType::WT_UNDERSHIRT
+ TRUE, //LLWearableType::WT_UNDERPANTS
+ FALSE //LLWearableType::WT_SKIRT
};
LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
if (create[i])
{
- llassert(getWearableCount((EWearableType)i) == 0);
- LLWearable* wearable = LLWearableList::instance().createNewWearable((EWearableType)i);
+ llassert(getWearableCount((LLWearableType::EType)i) == 0);
+ LLWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i);
((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
// no need to update here...
LLUUID category_id = LLUUID::null;
@@ -1164,6 +1164,7 @@ void LLAgentWearables::createStandardWearablesAllDone()
mWearablesLoaded = TRUE;
checkWearablesLoaded();
+ mLoadedSignal();
updateServer();
@@ -1174,16 +1175,16 @@ void LLAgentWearables::createStandardWearablesAllDone()
// MULTI-WEARABLE: Properly handle multiwearables later.
void LLAgentWearables::getAllWearablesArray(LLDynamicArray<S32>& wearables)
{
- for( S32 i = 0; i < WT_COUNT; ++i )
+ for( S32 i = 0; i < LLWearableType::WT_COUNT; ++i )
{
- if (getWearableCount((EWearableType) i) != 0)
+ if (getWearableCount((LLWearableType::EType) i) != 0)
{
wearables.push_back(i);
}
}
}
-// Note: wearables_to_include should be a list of EWearableType types
+// Note: wearables_to_include should be a list of LLWearableType::EType types
// attachments_to_include should be a list of attachment points
void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
const LLDynamicArray<S32>& wearables_to_include,
@@ -1213,9 +1214,9 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
for (i = 0; i < count; ++i)
{
const S32 type = wearables_to_include[i];
- for (U32 j=0; j<getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j<getWearableCount((LLWearableType::EType)i); j++)
{
- LLWearable* old_wearable = getWearable((EWearableType)type, j);
+ LLWearable* old_wearable = getWearable((LLWearableType::EType)type, j);
if (old_wearable)
{
std::string new_name;
@@ -1230,7 +1231,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
new_wearable->setName(new_name);
}
- LLViewerInventoryItem* item = gInventory.getItem(getWearableItemID((EWearableType)type,j));
+ LLViewerInventoryItem* item = gInventory.getItem(getWearableItemID((LLWearableType::EType)type,j));
S32 todo = addWearableToAgentInventoryCallback::CALL_NONE;
if (!found_first_item)
{
@@ -1250,7 +1251,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
llassert(item);
if (item)
{
- if (isWearableCopyable((EWearableType)type, j))
+ if (isWearableCopyable((LLWearableType::EType)type, j))
{
copy_inventory_item(
gAgent.getID(),
@@ -1364,7 +1365,7 @@ private:
void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
{
- LLUUID first_item_id = getWearableItemID((EWearableType)type, index);
+ LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
// Open the inventory and select the first item we added.
if (first_item_id.notNull())
{
@@ -1395,10 +1396,10 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback
cb);
}
-void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_all, U32 index)
+void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index)
{
if (gAgent.isTeen() &&
- (type == WT_UNDERSHIRT || type == WT_UNDERPANTS))
+ (type == LLWearableType::WT_UNDERSHIRT || type == LLWearableType::WT_UNDERPANTS))
{
// Can't take off underclothing in simple UI mode or on PG accounts
// TODO: enable the removing of a single undershirt/underpants if multiple are worn. - Nyx
@@ -1442,7 +1443,7 @@ void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_a
bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger();
+ LLWearableType::EType type = (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger();
S32 index = (S32)notification["payload"]["wearable_index"].asInteger();
switch(option)
{
@@ -1466,7 +1467,7 @@ bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LL
}
// Called by removeWearable() and onRemoveWearableDialog() to actually do the removal.
-void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_remove_all, U32 index)
+void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, bool do_remove_all, U32 index)
{
//LLAgentDumper dumper("removeWearable");
if (do_remove_all)
@@ -1515,11 +1516,11 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
{
// note: shirt is the first non-body part wearable item. Update if wearable order changes.
// This loop should remove all clothing, but not any body parts
- for (S32 type = 0; type < (S32)WT_COUNT; type++)
+ for (S32 type = 0; type < (S32)LLWearableType::WT_COUNT; type++)
{
- if (LLWearableDictionary::getAssetType((EWearableType)type) == LLAssetType::AT_CLOTHING)
+ if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING)
{
- removeWearable((EWearableType)type, true, 0);
+ removeWearable((LLWearableType::EType)type, true, 0);
}
}
}
@@ -1536,12 +1537,12 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
llassert(new_wearable);
if (new_wearable)
{
- const EWearableType type = new_wearable->getType();
+ const LLWearableType::EType type = new_wearable->getType();
new_wearable->setName(new_item->getName());
new_wearable->setItemID(new_item->getUUID());
- if (LLWearableDictionary::getAssetType(type) == LLAssetType::AT_BODYPART)
+ if (LLWearableType::getAssetType(type) == LLAssetType::AT_BODYPART)
{
// exactly one wearable per body part
setWearable(type,0,new_wearable);
@@ -1567,6 +1568,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// Start rendering & update the server
mWearablesLoaded = TRUE;
checkWearablesLoaded();
+ mLoadedSignal();
queryWearableCache();
updateServer();
@@ -1584,7 +1586,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
return;
}
- const EWearableType type = new_wearable->getType();
+ const LLWearableType::EType type = new_wearable->getType();
if (!do_append)
{
@@ -1597,7 +1599,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
(old_item_id == new_item->getUUID()))
{
- lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl;
+ lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName(type) << llendl;
return;
}
@@ -1654,7 +1656,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD&
// MULTI_WEARABLE: unify code after null objects are gone.
void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
{
- const EWearableType type = new_wearable->getType();
+ const LLWearableType::EType type = new_wearable->getType();
if (do_append && getWearableItemID(type,0).notNull())
{
@@ -1724,7 +1726,7 @@ void LLAgentWearables::queryWearableCache()
bool hash_computed = false;
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
{
- const EWearableType baked_type = baked_dict->mWearables[i];
+ const LLWearableType::EType baked_type = baked_dict->mWearables[i];
const U32 num_wearables = getWearableCount(baked_type);
for (U32 index = 0; index < num_wearables; ++index)
{
@@ -1763,20 +1765,20 @@ void LLAgentWearables::queryWearableCache()
// User has picked "remove from avatar" from a menu.
// static
-void LLAgentWearables::userRemoveWearable(const EWearableType &type, const U32 &index)
+void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index)
{
- if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
- //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
+ if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
+ //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
{
gAgentWearables.removeWearable(type,false,index);
}
}
//static
-void LLAgentWearables::userRemoveWearablesOfType(const EWearableType &type)
+void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &type)
{
- if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
- //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
+ if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
+ //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
{
gAgentWearables.removeWearable(type,true,0);
}
@@ -1801,17 +1803,17 @@ void LLAgentWearables::userRemoveAllClothesStep2(BOOL proceed)
{
if (proceed)
{
- gAgentWearables.removeWearable(WT_SHIRT,true,0);
- gAgentWearables.removeWearable(WT_PANTS,true,0);
- gAgentWearables.removeWearable(WT_SHOES,true,0);
- gAgentWearables.removeWearable(WT_SOCKS,true,0);
- gAgentWearables.removeWearable(WT_JACKET,true,0);
- gAgentWearables.removeWearable(WT_GLOVES,true,0);
- gAgentWearables.removeWearable(WT_UNDERSHIRT,true,0);
- gAgentWearables.removeWearable(WT_UNDERPANTS,true,0);
- gAgentWearables.removeWearable(WT_SKIRT,true,0);
- gAgentWearables.removeWearable(WT_ALPHA,true,0);
- gAgentWearables.removeWearable(WT_TATTOO,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SHIRT,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_PANTS,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SHOES,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SOCKS,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_JACKET,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_GLOVES,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_UNDERSHIRT,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_UNDERPANTS,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SKIRT,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_ALPHA,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_TATTOO,true,0);
}
}
@@ -2012,24 +2014,28 @@ BOOL LLAgentWearables::areWearablesLoaded() const
void LLAgentWearables::updateWearablesLoaded()
{
mWearablesLoaded = (itemUpdatePendingCount()==0);
+ if (mWearablesLoaded)
+ {
+ mLoadedSignal();
+ }
}
bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
{
if (!wearable) return false;
- EWearableType type = wearable->getType();
+ LLWearableType::EType type = wearable->getType();
// Make sure the user always has at least one shape, skin, eyes, and hair type currently worn.
- return !(((type == WT_SHAPE) || (type == WT_SKIN) || (type == WT_HAIR) || (type == WT_EYES))
+ return !(((type == LLWearableType::WT_SHAPE) || (type == LLWearableType::WT_SKIN) || (type == LLWearableType::WT_HAIR) || (type == LLWearableType::WT_EYES))
&& (getWearableCount(type) <= 1) );
}
void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
{
- for( S32 type = 0; type < WT_COUNT; ++type )
+ for( S32 type = 0; type < LLWearableType::WT_COUNT; ++type )
{
- for (S32 count = 0; count < (S32)getWearableCount((EWearableType)type); ++count)
+ for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
{
- LLWearable *wearable = getWearable((EWearableType)type,count);
+ LLWearable *wearable = getWearable((LLWearableType::EType)type,count);
wearable->animateParams(delta, upload_bake);
}
}
@@ -2091,3 +2097,8 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
outfits->done();
}
}
+
+boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_t cb)
+{
+ return mLoadedSignal.connect(cb);
+}
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index d3b18f68f1..def16e4e85 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -71,8 +71,8 @@ protected:
//--------------------------------------------------------------------
public:
BOOL isWearingItem(const LLUUID& item_id) const;
- BOOL isWearableModifiable(EWearableType type, U32 index /*= 0*/) const;
- BOOL isWearableCopyable(EWearableType type, U32 index /*= 0*/) const;
+ BOOL isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const;
+ BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const;
BOOL areWearablesLoaded() const;
void updateWearablesLoaded();
void checkWearablesLoaded() const;
@@ -88,17 +88,17 @@ public:
// Accessors
//--------------------------------------------------------------------
public:
- const LLUUID getWearableItemID(EWearableType type, U32 index /*= 0*/) const;
- const LLUUID getWearableAssetID(EWearableType type, U32 index /*= 0*/) const;
+ const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
+ const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
const LLWearable* getWearableFromItemID(const LLUUID& item_id) const;
LLWearable* getWearableFromAssetID(const LLUUID& asset_id);
- LLInventoryItem* getWearableInventoryItem(EWearableType type, U32 index /*= 0*/);
+ LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
// MULTI-WEARABLE: assuming one per type.
- static BOOL selfHasWearable(EWearableType type);
- LLWearable* getWearable(const EWearableType type, U32 index /*= 0*/);
- const LLWearable* getWearable(const EWearableType type, U32 index /*= 0*/) const;
- LLWearable* getTopWearable(const EWearableType type);
- U32 getWearableCount(const EWearableType type) const;
+ static BOOL selfHasWearable(LLWearableType::EType type);
+ LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+ const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
+ LLWearable* getTopWearable(const LLWearableType::EType type);
+ U32 getWearableCount(const LLWearableType::EType type) const;
U32 getWearableCount(const U32 tex_index) const;
//--------------------------------------------------------------------
@@ -107,17 +107,17 @@ public:
private:
// Low-level data structure setter - public access is via setWearableItem, etc.
- void setWearable(const EWearableType type, U32 index, LLWearable *wearable);
- U32 pushWearable(const EWearableType type, LLWearable *wearable);
+ void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
+ U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable);
void wearableUpdated(LLWearable *wearable);
void popWearable(LLWearable *wearable);
- void popWearable(const EWearableType type, U32 index);
+ void popWearable(const LLWearableType::EType type, U32 index);
public:
void setWearableItem(LLInventoryItem* new_item, LLWearable* wearable, bool do_append = false);
void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove);
void setWearableName(const LLUUID& item_id, const std::string& new_name);
- void addLocalTextureObject(const EWearableType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index);
+ void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index);
U32 getWearableIndex(LLWearable *wearable);
protected:
@@ -132,16 +132,16 @@ protected:
const U32 index,
const LLUUID& item_id,
LLWearable* wearable);
- void recoverMissingWearable(const EWearableType type, U32 index /*= 0*/);
+ void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
void recoverMissingWearableDone();
//--------------------------------------------------------------------
// Removing wearables
//--------------------------------------------------------------------
public:
- void removeWearable(const EWearableType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
+ void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
private:
- void removeWearableFinal(const EWearableType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
+ void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
protected:
static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
static void userRemoveAllClothesStep2(BOOL proceed); // userdata is NULL
@@ -165,7 +165,7 @@ protected:
public:
void getAllWearablesArray(LLDynamicArray<S32>& wearables);
- // Note: wearables_to_include should be a list of EWearableType types
+ // Note: wearables_to_include should be a list of LLWearableType::EType types
// attachments_to_include should be a list of attachment points
void makeNewOutfit(const std::string& new_folder_name,
const LLDynamicArray<S32>& wearables_to_include,
@@ -185,17 +185,17 @@ private:
//--------------------------------------------------------------------
public:
// MULTI-WEARABLE: assumes one per type.
- void saveWearableAs(const EWearableType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found);
- void saveWearable(const EWearableType type, const U32 index, BOOL send_update = TRUE);
+ void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found);
+ void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE);
void saveAllWearables();
- void revertWearable(const EWearableType type, const U32 index);
+ void revertWearable(const LLWearableType::EType type, const U32 index);
//--------------------------------------------------------------------
// Static UI hooks
//--------------------------------------------------------------------
public:
- static void userRemoveWearable(const EWearableType &type, const U32 &index);
- static void userRemoveWearablesOfType(const EWearableType &type);
+ static void userRemoveWearable(const LLWearableType::EType &type, const U32 &index);
+ static void userRemoveWearablesOfType(const LLWearableType::EType &type);
static void userRemoveAllClothes();
typedef std::vector<LLViewerObject*> llvo_vec_t;
@@ -209,11 +209,22 @@ public:
U32 itemUpdatePendingCount() const;
//--------------------------------------------------------------------
+ // Signals
+ //--------------------------------------------------------------------
+public:
+ typedef boost::function<void()> loaded_callback_t;
+ typedef boost::signals2::signal<void()> loaded_signal_t;
+ boost::signals2::connection addLoadedCallback(loaded_callback_t cb);
+
+private:
+ loaded_signal_t mLoadedSignal; // emitted when all agent wearables get loaded
+
+ //--------------------------------------------------------------------
// Member variables
//--------------------------------------------------------------------
private:
typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
- typedef std::map<EWearableType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
+ typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
wearableentry_map_t mWearableDatas;
static BOOL mInitialWearablesUpdateReceived;
@@ -248,7 +259,7 @@ private:
CALL_WEARITEM = 16
};
- // MULTI-WEARABLE: index is an EWearableType - more confusing usage.
+ // MULTI-WEARABLE: index is an LLWearableType::EType - more confusing usage.
// MULTI-WEARABLE: need to have type and index args both?
addWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
S32 type,
diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h
index 6695727d46..faa5fbaa43 100644
--- a/indra/newview/llagentwearablesfetch.h
+++ b/indra/newview/llagentwearablesfetch.h
@@ -34,7 +34,7 @@
#define LL_LLAGENTWEARABLESINITIALFETCH_H
#include "llinventoryobserver.h"
-#include "llwearabledictionary.h"
+#include "llwearabletype.h"
#include "lluuid.h"
//--------------------------------------------------------------------
@@ -53,10 +53,10 @@ public:
struct InitialWearableData
{
- EWearableType mType;
+ LLWearableType::EType mType;
LLUUID mItemID;
LLUUID mAssetID;
- InitialWearableData(EWearableType type, LLUUID& itemID, LLUUID& assetID) :
+ InitialWearableData(LLWearableType::EType type, LLUUID& itemID, LLUUID& assetID) :
mType(type),
mItemID(itemID),
mAssetID(assetID)
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index e93e29ecde..be840cc348 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -55,6 +55,25 @@
char ORDER_NUMBER_SEPARATOR('@');
+// support for secondlife:///app/appearance SLapps
+class LLAppearanceHandler : public LLCommandHandler
+{
+public:
+ // requests will be throttled from a non-trusted browser
+ LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {}
+
+ bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+ {
+ // support secondlife:///app/appearance/show, but for now we just
+ // make all secondlife:///app/appearance SLapps behave this way
+ LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD());
+ return true;
+ }
+};
+
+LLAppearanceHandler gAppearanceHandler;
+
+
LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string& name)
{
LLInventoryModel::cat_array_t cat_array;
@@ -137,7 +156,7 @@ public:
class LLFindClothesOfType : public LLInventoryCollectFunctor
{
public:
- LLFindClothesOfType(EWearableType type) : mWearableType(type) {}
+ LLFindClothesOfType(LLWearableType::EType type) : mWearableType(type) {}
virtual ~LLFindClothesOfType() {}
virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
@@ -150,7 +169,7 @@ public:
return true;
}
- const EWearableType mWearableType;
+ const LLWearableType::EType mWearableType;
};
@@ -179,14 +198,14 @@ struct LLFoundData
{
LLFoundData() :
mAssetType(LLAssetType::AT_NONE),
- mWearableType(WT_INVALID),
+ mWearableType(LLWearableType::WT_INVALID),
mWearable(NULL) {}
LLFoundData(const LLUUID& item_id,
const LLUUID& asset_id,
const std::string& name,
const LLAssetType::EType& asset_type,
- const EWearableType& wearable_type
+ const LLWearableType::EType& wearable_type
) :
mItemID(item_id),
mAssetID(asset_id),
@@ -199,7 +218,7 @@ struct LLFoundData
LLUUID mAssetID;
std::string mName;
LLAssetType::EType mAssetType;
- EWearableType mWearableType;
+ LLWearableType::EType mWearableType;
LLWearable* mWearable;
};
@@ -218,7 +237,7 @@ public:
void checkMissingWearables();
bool pollMissingWearables();
bool isMissingCompleted();
- void recoverMissingWearable(EWearableType type);
+ void recoverMissingWearable(LLWearableType::EType type);
void clearCOFLinksForMissingWearables();
void onWearableAssetFetch(LLWearable *wearable);
@@ -259,18 +278,18 @@ bool LLWearableHoldingPattern::isTimedOut()
void LLWearableHoldingPattern::checkMissingWearables()
{
- std::vector<S32> found_by_type(WT_COUNT,0);
- std::vector<S32> requested_by_type(WT_COUNT,0);
+ std::vector<S32> found_by_type(LLWearableType::WT_COUNT,0);
+ std::vector<S32> requested_by_type(LLWearableType::WT_COUNT,0);
for (found_list_t::iterator it = mFoundList.begin(); it != mFoundList.end(); ++it)
{
LLFoundData &data = *it;
- if (data.mWearableType < WT_COUNT)
+ if (data.mWearableType < LLWearableType::WT_COUNT)
requested_by_type[data.mWearableType]++;
if (data.mWearable)
found_by_type[data.mWearableType]++;
}
- for (S32 type = 0; type < WT_COUNT; ++type)
+ for (S32 type = 0; type < LLWearableType::WT_COUNT; ++type)
{
llinfos << "type " << type << " requested " << requested_by_type[type] << " found " << found_by_type[type] << llendl;
if (found_by_type[type] > 0)
@@ -281,11 +300,11 @@ void LLWearableHoldingPattern::checkMissingWearables()
// pants)
(requested_by_type[type] > 0) ||
// or if type is a body part and no wearables were found.
- ((type == WT_SHAPE) || (type == WT_SKIN) || (type == WT_HAIR) || (type == WT_EYES)))
+ ((type == LLWearableType::WT_SHAPE) || (type == LLWearableType::WT_SKIN) || (type == LLWearableType::WT_HAIR) || (type == LLWearableType::WT_EYES)))
{
mTypesToRecover.insert(type);
mTypesToLink.insert(type);
- recoverMissingWearable((EWearableType)type);
+ recoverMissingWearable((LLWearableType::EType)type);
llwarns << "need to replace " << type << llendl;
}
}
@@ -368,7 +387,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
class RecoveredItemLinkCB: public LLInventoryCallback
{
public:
- RecoveredItemLinkCB(EWearableType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
+ RecoveredItemLinkCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
mHolder(holder),
mWearable(wearable),
mType(type)
@@ -392,7 +411,7 @@ public:
linked_item->getAssetUUID(),
linked_item->getName(),
linked_item->getType(),
- linked_item->isWearableType() ? linked_item->getWearableType() : WT_INVALID
+ linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID
);
found.mWearable = mWearable;
mHolder->mFoundList.push_front(found);
@@ -410,13 +429,13 @@ public:
private:
LLWearableHoldingPattern* mHolder;
LLWearable *mWearable;
- EWearableType mType;
+ LLWearableType::EType mType;
};
class RecoveredItemCB: public LLInventoryCallback
{
public:
- RecoveredItemCB(EWearableType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
+ RecoveredItemCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
mHolder(holder),
mWearable(wearable),
mType(type)
@@ -444,14 +463,14 @@ public:
private:
LLWearableHoldingPattern* mHolder;
LLWearable *mWearable;
- EWearableType mType;
+ LLWearableType::EType mType;
};
-void LLWearableHoldingPattern::recoverMissingWearable(EWearableType type)
+void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type)
{
// Try to recover by replacing missing wearable with a new one.
LLNotificationsUtil::add("ReplacedMissingWearable");
- lldebugs << "Wearable " << LLWearableDictionary::getTypeLabel(type)
+ lldebugs << "Wearable " << LLWearableType::getTypeLabel(type)
<< " could not be downloaded. Replaced inventory item with default wearable." << llendl;
LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
@@ -482,7 +501,7 @@ void LLWearableHoldingPattern::clearCOFLinksForMissingWearables()
for (found_list_t::iterator it = mFoundList.begin(); it != mFoundList.end(); ++it)
{
LLFoundData &data = *it;
- if ((data.mWearableType < WT_COUNT) && (!data.mWearable))
+ if ((data.mWearableType < LLWearableType::WT_COUNT) && (!data.mWearable))
{
// Wearable link that was never resolved; remove links to it from COF
llinfos << "removing link for unresolved item " << data.mItemID.asString() << llendl;
@@ -543,7 +562,7 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
{
data.mWearable = wearable;
// Failing this means inventory or asset server are corrupted in a way we don't handle.
- llassert((data.mWearableType < WT_COUNT) && (wearable->getType() == data.mWearableType));
+ llassert((data.mWearableType < LLWearableType::WT_COUNT) && (wearable->getType() == data.mWearableType));
break;
}
}
@@ -778,10 +797,10 @@ BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
// These are the wearable items that are required for considering this
// folder as containing a complete outfit.
U32 required_wearables = 0;
- required_wearables |= 1LL << WT_SHAPE;
- required_wearables |= 1LL << WT_SKIN;
- required_wearables |= 1LL << WT_HAIR;
- required_wearables |= 1LL << WT_EYES;
+ required_wearables |= 1LL << LLWearableType::WT_SHAPE;
+ required_wearables |= 1LL << LLWearableType::WT_SKIN;
+ required_wearables |= 1LL << LLWearableType::WT_HAIR;
+ required_wearables |= 1LL << LLWearableType::WT_EYES;
// These are the wearables that the folder actually contains.
U32 folder_wearables = 0;
@@ -795,7 +814,7 @@ BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
const LLViewerInventoryItem* item = (*iter);
if (item->isWearableType())
{
- const EWearableType wearable_type = item->getWearableType();
+ const LLWearableType::EType wearable_type = item->getWearableType();
folder_wearables |= 1LL << wearable_type;
}
}
@@ -851,12 +870,12 @@ void LLAppearanceMgr::filterWearableItems(
LLInventoryModel::item_array_t& items, S32 max_per_type)
{
// Divvy items into arrays by wearable type.
- std::vector<LLInventoryModel::item_array_t> items_by_type(WT_COUNT);
+ std::vector<LLInventoryModel::item_array_t> items_by_type(LLWearableType::WT_COUNT);
divvyWearablesByType(items, items_by_type);
// rebuild items list, retaining the last max_per_type of each array
items.clear();
- for (S32 i=0; i<WT_COUNT; i++)
+ for (S32 i=0; i<LLWearableType::WT_COUNT; i++)
{
S32 size = items_by_type[i].size();
if (size <= 0)
@@ -1001,7 +1020,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
// For each wearable type, find the first instance in the category
// that we recursed through.
- for( S32 i = 0; i < WT_COUNT; i++ )
+ for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
{
for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin();
iter != holder->mFoundList.end(); ++iter)
@@ -1115,14 +1134,14 @@ void LLAppearanceMgr::updateAppearanceFromCOF()
linked_item->getAssetUUID(),
linked_item->getName(),
linked_item->getType(),
- linked_item->isWearableType() ? linked_item->getWearableType() : WT_INVALID
+ linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID
);
#if 0
// Fault injection: uncomment this block to test asset
// fetch failures (should be replaced by new defaults in
// lost&found).
- if (found.mWearableType == WT_SHAPE || found.mWearableType == WT_JACKET)
+ if (found.mWearableType == LLWearableType::WT_SHAPE || found.mWearableType == LLWearableType::WT_JACKET)
{
found.mAssetID.generate(); // Replace with new UUID, guaranteed not to exist in DB
@@ -1654,7 +1673,7 @@ bool LLAppearanceMgr::updateBaseOutfit()
void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type)
{
- items_by_type.reserve(WT_COUNT);
+ items_by_type.reserve(LLWearableType::WT_COUNT);
if (items.empty()) return;
for (S32 i=0; i<items.count(); i++)
@@ -1663,8 +1682,8 @@ void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t&
// Ignore non-wearables.
if (!item->isWearableType())
continue;
- EWearableType type = item->getWearableType();
- if(type < 0 || type >= WT_COUNT)
+ LLWearableType::EType type = item->getWearableType();
+ if(type < 0 || type >= LLWearableType::WT_COUNT)
{
LL_WARNS("Appearance") << "Invalid wearable type. Inventory type does not match wearable flag bitfield." << LL_ENDL;
continue;
@@ -1673,7 +1692,7 @@ void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t&
}
}
-std::string build_order_string(EWearableType type, U32 i)
+std::string build_order_string(LLWearableType::EType type, U32 i)
{
std::ostringstream order_num;
order_num << ORDER_NUMBER_SEPARATOR << type * 100 + i;
@@ -1682,7 +1701,7 @@ std::string build_order_string(EWearableType type, U32 i)
struct WearablesOrderComparator
{
- WearablesOrderComparator(const EWearableType type)
+ WearablesOrderComparator(const LLWearableType::EType type)
{
mControlSize = build_order_string(type, 0).size();
};
@@ -1720,18 +1739,18 @@ void LLAppearanceMgr::updateClothingOrderingInfo()
LLInventoryModel::item_array_t wear_items;
getDescendentsOfAssetType(getCOF(), wear_items, LLAssetType::AT_CLOTHING, false);
- wearables_by_type_t items_by_type(WT_COUNT);
+ wearables_by_type_t items_by_type(LLWearableType::WT_COUNT);
divvyWearablesByType(wear_items, items_by_type);
bool inventory_changed = false;
- for (U32 type = WT_SHIRT; type < WT_COUNT; type++)
+ for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++)
{
U32 size = items_by_type[type].size();
if (!size) continue;
//sinking down invalid items which need reordering
- std::sort(items_by_type[type].begin(), items_by_type[type].end(), WearablesOrderComparator((EWearableType) type));
+ std::sort(items_by_type[type].begin(), items_by_type[type].end(), WearablesOrderComparator((LLWearableType::EType) type));
//requesting updates only for those links which don't have "valid" descriptions
for (U32 i = 0; i < size; i++)
@@ -1739,7 +1758,7 @@ void LLAppearanceMgr::updateClothingOrderingInfo()
LLViewerInventoryItem* item = items_by_type[type][i];
if (!item) continue;
- std::string new_order_str = build_order_string((EWearableType)type, i);
+ std::string new_order_str = build_order_string((LLWearableType::EType)type, i);
if (new_order_str == item->LLInventoryItem::getDescription()) continue;
item->setDescription(new_order_str);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 8db0388c64..f7f7cb599e 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -153,7 +153,7 @@
#include "llworld.h"
#include "llhudeffecttrail.h"
#include "llvectorperfoptions.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
#include "llwatchdog.h"
// Included so that constants/settings might be initialized
@@ -193,6 +193,9 @@
#include "llparcel.h"
#include "llavatariconctrl.h"
+// Include for security api initialization
+#include "llsecapi.h"
+
// *FIX: These extern globals should be cleaned up.
// The globals either represent state/config/resource-storage of either
// this app, or another 'component' of the viewer. App globals should be
@@ -507,35 +510,6 @@ public:
}
};
-void LLAppViewer::initGridChoice()
-{
- // Load up the initial grid choice from:
- // - hard coded defaults...
- // - command line settings...
- // - if dev build, persisted settings...
-
- // Set the "grid choice", this is specified by command line.
- std::string grid_choice = gSavedSettings.getString("CmdLineGridChoice");
- LLViewerLogin::getInstance()->setGridChoice(grid_choice);
-
- // Load last server choice by default
- // ignored if the command line grid choice has been set
- if(grid_choice.empty())
- {
- S32 server = gSavedSettings.getS32("ServerChoice");
- server = llclamp(server, 0, (S32)GRID_INFO_COUNT - 1);
- if(server == GRID_INFO_OTHER)
- {
- std::string custom_server = gSavedSettings.getString("CustomServer");
- LLViewerLogin::getInstance()->setGridChoice(custom_server);
- }
- else if(server != (S32)GRID_INFO_NONE)
- {
- LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server);
- }
- }
-}
-
//virtual
bool LLAppViewer::initSLURLHandler()
{
@@ -647,7 +621,6 @@ bool LLAppViewer::init()
LLCurl::initClass();
initThreads();
-
writeSystemInfo();
// Build a string representing the current version number.
@@ -777,10 +750,6 @@ bool LLAppViewer::init()
return false;
}
- // Always fetch the Ethernet MAC address, needed both for login
- // and password load.
- LLUUID::getNodeID(gMACAddress);
-
// Prepare for out-of-memory situations, during which we will crash on
// purpose and save a dump.
#if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP
@@ -892,6 +861,7 @@ bool LLAppViewer::init()
}
}
+
// save the graphics card
gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString();
@@ -902,6 +872,17 @@ bool LLAppViewer::init()
gSimFrames = (F32)gFrameCount;
LLViewerJoystick::getInstance()->init(false);
+
+ try {
+ initializeSecHandler();
+ }
+ catch (LLProtectedDataException ex)
+ {
+ LLNotificationsUtil::add("CorruptedProtectedDataStore");
+ }
+ LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback);
+
+
gGLActive = FALSE;
if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
{
@@ -936,13 +917,11 @@ bool LLAppViewer::mainLoop()
gServicePump = new LLPumpIO(gAPRPoolp);
LLHTTPClient::setPump(*gServicePump);
LLCurl::setCAFile(gDirUtilp->getCAFile());
- LLCurl::setSSLVerify(! gSavedSettings.getBOOL("NoVerifySSLCert"));
-
+
// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
LLVoiceChannel::initClass();
- LLVoiceClient::init(gServicePump);
-
+ LLVoiceClient::getInstance()->init(gServicePump);
LLTimer frameTimer,idleTimer;
LLTimer debugTime;
LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
@@ -1273,7 +1252,7 @@ bool LLAppViewer::cleanup()
// to ensure shutdown order
LLMortician::setZealous(TRUE);
- LLVoiceClient::terminate();
+ LLVoiceClient::getInstance()->terminate();
disconnectViewer();
@@ -1472,13 +1451,6 @@ bool LLAppViewer::cleanup()
llinfos << "Saving Data" << llendflush;
- // Quitting with "Remember Password" turned off should always stomp your
- // saved password, whether or not you successfully logged in. JC
- if (!gSavedSettings.getBOOL("RememberPassword"))
- {
- LLStartUp::deletePasswordFromDisk();
- }
-
// Store the time of our current logoff
gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
@@ -2050,7 +2022,6 @@ bool LLAppViewer::initConfiguration()
}
}
- initGridChoice();
// If we have specified crash on startup, set the global so we'll trigger the crash at the right time
if(clp.hasOption("crashonstartup"))
@@ -2144,30 +2115,17 @@ bool LLAppViewer::initConfiguration()
// injection and steal passwords. Phoenix. SL-55321
if(clp.hasOption("url"))
{
- std::string slurl = clp.getOption("url")[0];
- if (LLSLURL::isSLURLCommand(slurl))
- {
- LLStartUp::sSLURLCommand = slurl;
- }
- else
- {
- LLURLSimString::setString(slurl);
- }
+ LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0]));
+ if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION)
+ {
+ LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid());
+
+ }
}
else if(clp.hasOption("slurl"))
{
- std::string slurl = clp.getOption("slurl")[0];
- if(LLSLURL::isSLURL(slurl))
- {
- if (LLSLURL::isSLURLCommand(slurl))
- {
- LLStartUp::sSLURLCommand = slurl;
- }
- else
- {
- LLURLSimString::setString(slurl);
- }
- }
+ LLSLURL start_slurl(clp.getOption("slurl")[0]);
+ LLStartUp::setStartSLURL(start_slurl);
}
const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
@@ -2248,18 +2206,10 @@ bool LLAppViewer::initConfiguration()
// don't call anotherInstanceRunning() when doing URL handoff, as
// it relies on checking a marker file which will not work when running
// out of different directories
- std::string slurl;
- if (!LLStartUp::sSLURLCommand.empty())
- {
- slurl = LLStartUp::sSLURLCommand;
- }
- else if (LLURLSimString::parse())
- {
- slurl = LLURLSimString::getURL();
- }
- if (!slurl.empty())
+
+ if (LLStartUp::getStartSLURL().isValid())
{
- if (sendURLToOtherInstance(slurl))
+ if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString()))
{
// successfully handed off URL to existing instance, exit
return false;
@@ -2315,9 +2265,9 @@ bool LLAppViewer::initConfiguration()
// need to do this here - need to have initialized global settings first
std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
- if ( nextLoginLocation.length() )
+ if ( !nextLoginLocation.empty() )
{
- LLURLSimString::setString( nextLoginLocation );
+ LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
};
gLastRunVersion = gSavedSettings.getString("LastRunVersion");
@@ -2538,7 +2488,7 @@ void LLAppViewer::writeSystemInfo()
// The user is not logged on yet, but record the current grid choice login url
// which may have been the intended grid. This can b
- gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
+ gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
// *FIX:Mani - move this down in llappviewerwin32
#ifdef LL_WINDOWS
@@ -3915,7 +3865,7 @@ void LLAppViewer::sendLogoutRequest()
gLogoutMaxTime = LOGOUT_REQUEST_TIME;
mLogoutRequestSent = TRUE;
- gVoiceClient->leaveChannel();
+ LLVoiceClient::getInstance()->leaveChannel();
//Set internal status variables and marker files
gLogoutInProgress = TRUE;
@@ -4328,7 +4278,7 @@ void LLAppViewer::launchUpdater()
#endif
// *TODO change userserver to be grid on both viewer and sim, since
// userserver no longer exists.
- query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel();
+ query_map["userserver"] = LLGridManager::getInstance()->getGridLabel();
query_map["channel"] = gSavedSettings.getString("VersionChannelName");
// *TODO constantize this guy
// *NOTE: This URL is also used in win_setup/lldownloader.cpp
@@ -4341,10 +4291,10 @@ void LLAppViewer::launchUpdater()
LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ;
// if a sim name was passed in via command line parameter (typically through a SLURL)
- if ( LLURLSimString::sInstance.mSimString.length() )
+ if ( LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION )
{
// record the location to start at next time
- gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString );
+ gSavedSettings.setString( "NextLoginLocation", LLStartUp::getStartSLURL().getSLURLString());
};
#if LL_WINDOWS
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 60645c46d4..5acd6e11c4 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -193,7 +193,6 @@ private:
bool initThreads(); // Initialize viewer threads, return false on failure.
bool initConfiguration(); // Initialize settings from the command line/config file.
- void initGridChoice();
bool initCache(); // Initialize local client cache.
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index d34bcb4a68..78b0f7ba83 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -604,7 +604,7 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
{cmd.c_str(),
ask_dialog,
"-user",
- (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(),
+ (char*)LLGridManager::getInstance()->getGridLabel().c_str(),
"-name",
LLAppViewer::instance()->getSecondLifeTitle().c_str(),
NULL};
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 44ef39fb7d..0b5f18c330 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -44,7 +44,6 @@
#include "llviewernetwork.h"
#include "llviewercontrol.h"
#include "llmd5.h"
-#include "llurlsimstring.h"
#include "llfloaterworldmap.h"
#include "llurldispatcher.h"
#include <Carbon/Carbon.h>
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 764d54a987..00d9bbe18b 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -286,7 +286,7 @@ bool LLAvatarActions::isCalling(const LLUUID &id)
//static
bool LLAvatarActions::canCall()
{
- return LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
+ return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
}
// static
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index dfb213716c..47ec5270c3 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -316,9 +316,7 @@ void LLAvatarList::refresh()
}
// Send refresh_complete signal.
- std::vector<LLSD> cur_values;
- getValues(cur_values);
- mRefreshCompleteSignal(this, LLSD((S32)cur_values.size()));
+ mRefreshCompleteSignal(this, LLSD((S32)size(false)));
}
// Commit if we've added/removed items.
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 2a51eeacfc..656274cb7a 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -36,12 +36,13 @@
#include "llavataractions.h"
#include "llavatarlistitem.h"
+#include "llbutton.h"
#include "llfloaterreg.h"
+#include "lluitextutil.h"
+
#include "llagent.h"
-#include "lloutputmonitorctrl.h"
#include "llavatariconctrl.h"
-#include "lltextutil.h"
-#include "llbutton.h"
+#include "lloutputmonitorctrl.h"
bool LLAvatarListItem::sStaticInitialized = false;
S32 LLAvatarListItem::sLeftPadding = 0;
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 4ebccbe731..226d5593c9 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -301,7 +301,7 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b
// skipped to avoid button blinking
if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL)
{
- mSpeakBtn->setFlyoutBtnEnabled(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
+ mSpeakBtn->setFlyoutBtnEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
}
}
@@ -471,18 +471,13 @@ BOOL LLBottomTray::postBuild()
mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") );
// Registering Chat Bar to receive Voice client status change notifications.
- gVoiceClient->addObserver(this);
-
- mObjectDefaultWidthMap[RS_BUTTON_GESTURES] = mGesturePanel->getRect().getWidth();
- mObjectDefaultWidthMap[RS_BUTTON_MOVEMENT] = mMovementPanel->getRect().getWidth();
- mObjectDefaultWidthMap[RS_BUTTON_CAMERA] = mCamPanel->getRect().getWidth();
- mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth();
+ LLVoiceClient::getInstance()->addObserver(this);
mNearbyChatBar->getChatBox()->setContextMenu(NULL);
mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
- initStateProcessedObjectMap();
+ initResizeStateContainers();
// update wells visibility:
showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty());
@@ -711,27 +706,9 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
S32 buttons_freed_width = 0;
if (still_should_be_processed)
{
- processShrinkButtons(&delta_width, &buttons_freed_width);
+ processShrinkButtons(delta_width, buttons_freed_width);
- if (delta_width < 0)
- {
- processHideButton(RS_BUTTON_SNAPSHOT, &delta_width, &buttons_freed_width);
- }
-
- if (delta_width < 0)
- {
- processHideButton(RS_BUTTON_CAMERA, &delta_width, &buttons_freed_width);
- }
-
- if (delta_width < 0)
- {
- processHideButton(RS_BUTTON_MOVEMENT, &delta_width, &buttons_freed_width);
- }
-
- if (delta_width < 0)
- {
- processHideButton(RS_BUTTON_GESTURES, &delta_width, &buttons_freed_width);
- }
+ processHideButtons(delta_width, buttons_freed_width);
if (delta_width < 0)
{
@@ -776,27 +753,10 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
<< llendl;
S32 available_width = total_available_width;
- if (available_width > 0)
- {
- processShowButton(RS_BUTTON_GESTURES, &available_width);
- }
-
- if (available_width > 0)
- {
- processShowButton(RS_BUTTON_MOVEMENT, &available_width);
- }
-
- if (available_width > 0)
- {
- processShowButton(RS_BUTTON_CAMERA, &available_width);
- }
- if (available_width > 0)
- {
- processShowButton(RS_BUTTON_SNAPSHOT, &available_width);
- }
+ processShowButtons(available_width);
- processExtendButtons(&available_width);
+ processExtendButtons(available_width);
// if we have to show/extend some buttons but resized delta width is not enough...
S32 processed_width = total_available_width - available_width;
@@ -853,7 +813,23 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
}
}
-bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width)
+void LLBottomTray::processShowButtons(S32& available_width)
+{
+ // process buttons from left to right
+ resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
+ const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
+
+ for (; it != it_end; ++it)
+ {
+ // is there available space?
+ if (available_width <= 0) break;
+
+ // try to show next button
+ processShowButton(*it, available_width);
+ }
+}
+
+bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& available_width)
{
lldebugs << "Trying to show object type: " << shown_object_type << llendl;
llassert(mStateProcessedObjectMap[shown_object_type] != NULL);
@@ -869,15 +845,15 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa
{
//validate if we have enough room to show this button
const S32 required_width = panel->getRect().getWidth();
- can_be_shown = *available_width >= required_width;
+ can_be_shown = available_width >= required_width;
if (can_be_shown)
{
- *available_width -= required_width;
+ available_width -= required_width;
setTrayButtonVisible(shown_object_type, true);
lldebugs << "processed object type: " << shown_object_type
- << ", rest available width: " << *available_width
+ << ", rest available width: " << available_width
<< llendl;
mResizeState &= ~shown_object_type;
}
@@ -885,7 +861,23 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa
return can_be_shown;
}
-void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width)
+void LLBottomTray::processHideButtons(S32& required_width, S32& buttons_freed_width)
+{
+ // process buttons from right to left
+ resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin();
+ const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend();
+
+ for (; it != it_end; ++it)
+ {
+ // is it still necessary to hide a button?
+ if (required_width >= 0) break;
+
+ // try to hide next button
+ processHideButton(*it, required_width, buttons_freed_width);
+ }
+}
+
+void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& required_width, S32& buttons_freed_width)
{
lldebugs << "Trying to hide object type: " << processed_object_type << llendl;
llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
@@ -899,11 +891,11 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* re
if (panel->getVisible())
{
- *required_width += panel->getRect().getWidth();
+ required_width += panel->getRect().getWidth();
- if (*required_width > 0)
+ if (required_width > 0)
{
- *buttons_freed_width += *required_width;
+ buttons_freed_width += required_width;
}
setTrayButtonVisible(processed_object_type, false);
@@ -911,24 +903,29 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* re
mResizeState |= processed_object_type;
lldebugs << "processing object type: " << processed_object_type
- << ", buttons_freed_width: " << *buttons_freed_width
+ << ", buttons_freed_width: " << buttons_freed_width
<< llendl;
}
}
-void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_width)
+void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_width)
{
- processShrinkButton(RS_BUTTON_CAMERA, required_width);
+ // process buttons from right to left
+ resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin();
+ const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend();
- if (*required_width < 0)
- {
- processShrinkButton(RS_BUTTON_MOVEMENT, required_width);
- }
- if (*required_width < 0)
+ // iterate through buttons in the mButtonsProcessOrder first
+ for (; it != it_end; ++it)
{
- processShrinkButton(RS_BUTTON_GESTURES, required_width);
+ // is it still necessary to hide a button?
+ if (required_width >= 0) break;
+
+ // try to shrink next button
+ processShrinkButton(*it, required_width);
}
- if (*required_width < 0)
+
+ // then shrink Speak button
+ if (required_width < 0)
{
S32 panel_min_width = 0;
@@ -948,23 +945,23 @@ void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_
mSpeakBtn->setLabelVisible(false);
mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight());
- *required_width += possible_shrink_width;
+ required_width += possible_shrink_width;
- if (*required_width > 0)
+ if (required_width > 0)
{
- *buttons_freed_width += *required_width;
+ buttons_freed_width += required_width;
}
- lldebugs << "Shrunk panel: " << panel_name
+ lldebugs << "Shrunk Speak button panel: " << panel_name
<< ", shrunk width: " << possible_shrink_width
- << ", rest width to process: " << *required_width
+ << ", rest width to process: " << required_width
<< llendl;
}
}
}
}
-void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32* required_width)
+void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32& required_width)
{
llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
@@ -992,63 +989,68 @@ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32*
// let calculate real width to shrink
// 1. apply all possible width
- *required_width += possible_shrink_width;
+ required_width += possible_shrink_width;
// 2. it it is too much...
- if (*required_width > 0)
+ if (required_width > 0)
{
// reduce applied shrunk width to the excessive value.
- possible_shrink_width -= *required_width;
- *required_width = 0;
+ possible_shrink_width -= required_width;
+ required_width = 0;
}
panel->reshape(panel_width - possible_shrink_width, panel->getRect().getHeight());
lldebugs << "Shrunk panel: " << panel_name
<< ", shrunk width: " << possible_shrink_width
- << ", rest width to process: " << *required_width
+ << ", rest width to process: " << required_width
<< llendl;
}
}
}
-void LLBottomTray::processExtendButtons(S32* available_width)
+void LLBottomTray::processExtendButtons(S32& available_width)
{
- // do not allow extending any buttons if we have some buttons hidden
+ // do not allow extending any buttons if we have some buttons hidden via resize
if (mResizeState & RS_BUTTONS_CAN_BE_HIDDEN) return;
- processExtendButton(RS_BUTTON_GESTURES, available_width);
+ // process buttons from left to right
+ resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
+ const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
- if (*available_width > 0)
- {
- processExtendButton(RS_BUTTON_MOVEMENT, available_width);
- }
- if (*available_width > 0)
+ // iterate through buttons in the mButtonsProcessOrder first
+ for (; it != it_end; ++it)
{
- processExtendButton(RS_BUTTON_CAMERA, available_width);
+ // is there available space?
+ if (available_width <= 0) break;
+
+ // try to extend next button
+ processExtendButton(*it, available_width);
}
- if (*available_width > 0)
+
+ // then try to extend Speak button
+ if (available_width > 0)
{
S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK];
S32 panel_width = mSpeakPanel->getRect().getWidth();
S32 possible_extend_width = panel_max_width - panel_width;
- if (possible_extend_width >= 0 && possible_extend_width <= *available_width) // HACK: this button doesn't change size so possible_extend_width will be 0
+ if (possible_extend_width >= 0 && possible_extend_width <= available_width) // HACK: this button doesn't change size so possible_extend_width will be 0
{
mSpeakBtn->setLabelVisible(true);
mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight());
log(mSpeakBtn, "speak button is extended");
- *available_width -= possible_extend_width;
+ available_width -= possible_extend_width;
- lldebugs << "Extending panel: " << mSpeakPanel->getName()
+ lldebugs << "Extending Speak button panel: " << mSpeakPanel->getName()
<< ", extended width: " << possible_extend_width
- << ", rest width to process: " << *available_width
+ << ", rest width to process: " << available_width
<< llendl;
}
}
}
-void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32* available_width)
+void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& available_width)
{
llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
@@ -1069,20 +1071,20 @@ void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32*
// let calculate real width to extend
// 1. apply all possible width
- *available_width -= possible_extend_width;
+ available_width -= possible_extend_width;
// 2. it it is too much...
- if (*available_width < 0)
+ if (available_width < 0)
{
// reduce applied extended width to the excessive value.
- possible_extend_width += *available_width;
- *available_width = 0;
+ possible_extend_width += available_width;
+ available_width = 0;
}
panel->reshape(panel_width + possible_extend_width, panel->getRect().getHeight());
lldebugs << "Extending panel: " << panel->getName()
<< ", extended width: " << possible_extend_width
- << ", rest width to process: " << *available_width
+ << ", rest width to process: " << available_width
<< llendl;
}
}
@@ -1116,17 +1118,25 @@ bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const
return can_be_shown;
}
-void LLBottomTray::initStateProcessedObjectMap()
+void LLBottomTray::initResizeStateContainers()
{
+ // init map with objects should be processed for each type
mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, mGesturePanel));
mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, mMovementPanel));
mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, mCamPanel));
mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, mSnapshotPanel));
- mDummiesMap.insert(std::make_pair(RS_BUTTON_GESTURES, getChild<LLUICtrl>("after_gesture_panel")));
- mDummiesMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, getChild<LLUICtrl>("after_movement_panel")));
- mDummiesMap.insert(std::make_pair(RS_BUTTON_CAMERA, getChild<LLUICtrl>("after_cam_panel")));
- mDummiesMap.insert(std::make_pair(RS_BUTTON_SPEAK, getChild<LLUICtrl>("after_speak_panel")));
+ // init default widths
+ mObjectDefaultWidthMap[RS_BUTTON_GESTURES] = mGesturePanel->getRect().getWidth();
+ mObjectDefaultWidthMap[RS_BUTTON_MOVEMENT] = mMovementPanel->getRect().getWidth();
+ mObjectDefaultWidthMap[RS_BUTTON_CAMERA] = mCamPanel->getRect().getWidth();
+ mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth();
+
+ // init an order of processed buttons
+ mButtonsProcessOrder.push_back(RS_BUTTON_GESTURES);
+ mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT);
+ mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA);
+ mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT);
}
void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible)
@@ -1140,12 +1150,6 @@ void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool vis
}
panel->setVisible(visible);
-
- if (mDummiesMap.count(shown_object_type))
- {
- // Hide/show layout panel for dummy icon.
- mDummiesMap[shown_object_type]->getParent()->setVisible(visible);
- }
}
void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification)
@@ -1168,20 +1172,13 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
return false;
}
- const S32 dummy_width = mDummiesMap.count(object_type)
- ? mDummiesMap[object_type]->getParent()->getRect().getWidth()
- : 0;
-
bool is_set = true;
if (visible)
{
- // Assume that only chiclet panel can be auto-resized and
- // don't take into account width of dummy widgets
+ // Assume that only chiclet panel can be auto-resized
const S32 available_width =
- mChicletPanel->getParent()->getRect().getWidth() -
- mChicletPanel->getMinWidth() -
- dummy_width;
+ mChicletPanel->getParent()->getRect().getWidth() - mChicletPanel->getMinWidth();
S32 preferred_width = mObjectDefaultWidthMap[object_type];
S32 current_width = cur_panel->getRect().getWidth();
@@ -1244,12 +1241,12 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
current_width = result_width;
}
- is_set = processShowButton(object_type, &current_width);
+ is_set = processShowButton(object_type, current_width);
// Shrink buttons if needed
if (is_set && decrease_width)
{
- processWidthDecreased( -result_width - dummy_width );
+ processWidthDecreased( -result_width);
}
}
else
@@ -1264,7 +1261,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
// Extend other buttons if need
if (delta_width)
{
- processWidthIncreased(delta_width + dummy_width);
+ processWidthIncreased(delta_width);
}
}
return is_set;
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index 8395b484cf..e9d59e82ba 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -128,29 +128,131 @@ private:
, RS_BUTTONS_CAN_BE_HIDDEN = RS_BUTTON_SNAPSHOT | RS_BUTTON_CAMERA | RS_BUTTON_MOVEMENT | RS_BUTTON_GESTURES
}EResizeState;
+ /**
+ * Updates child controls size and visibility when it is necessary to reduce total width.
+ *
+ * Process order:
+ * - reduce chiclet panel to its minimal width;
+ * - reduce chatbar to its minimal width;
+ * - reduce visible buttons from right to left to their minimal width;
+ * - hide visible buttons from right to left;
+ * When button is hidden chatbar extended to fill released space if it is necessary.
+ *
+ * @param[in] delta_width - value by which bottom tray should be shrunk. It is a negative value.
+ * @return positive value which bottom tray can not process when it reaches its minimal width.
+ * Zero if there was enough space to process delta_width.
+ */
S32 processWidthDecreased(S32 delta_width);
+
+ /**
+ * Updates child controls size and visibility when it is necessary to extend total width.
+ *
+ * Process order:
+ * - show invisible buttons should be shown from left to right if possible;
+ * - extend visible buttons from left to right to their default width;
+ * - extend chatbar to its maximal width;
+ * - extend chiclet panel to all available space;
+ * When chatbar & chiclet panels are wider then their minimal width they can be reduced to allow
+ * a button gets visible in case if passed delta_width is not enough (chatbar first).
+ *
+ * @param[in] delta_width - value by which bottom tray should be extended. It is a positive value.
+ */
void processWidthIncreased(S32 delta_width);
+
+ /** helper function to log debug messages */
void log(LLView* panel, const std::string& descr);
- bool processShowButton(EResizeState shown_object_type, S32* available_width);
- void processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width);
+
+ /**
+ * Tries to show hidden by resize buttons using available width.
+ *
+ * Gets buttons visible if there is enough space. Reduces available_width in this case.
+ *
+ * @params[in, out] available_width - reference to available width to be used to show buttons.
+ * @see processShowButton()
+ */
+ void processShowButtons(S32& available_width);
+
+ /**
+ * Tries to show panel with specified button using available width.
+ *
+ * Shows button specified by type if there is enough space. Reduces available_width in this case.
+ *
+ * @params[in] shown_object_type - type of button to be shown.
+ * @params[in, out] available_width - reference to available width to be used to show button.
+ *
+ * @return true if button can be shown, false otherwise
+ */
+ bool processShowButton(EResizeState shown_object_type, S32& available_width);
+
+ /**
+ * Hides visible panels with all buttons that may be hidden by resize if it is necessary.
+ *
+ * When button gets hidden some space is released in bottom tray.
+ * This space is taken into account for several consecutive calls for several buttons.
+ *
+ * @params[in, out] required_width - reference to required width to be released. This is a negative value.
+ * Its absolute value is decreased by shown panel width.
+ * @params[in, out] buttons_freed_width - reference to value released over required one.
+ * If panel's width is more than required difference is added to buttons_freed_width.
+ * @see processHideButton()
+ */
+ void processHideButtons(S32& required_width, S32& buttons_freed_width);
+
+ /**
+ * Hides panel with specified button if it is visible.
+ *
+ * When button gets hidden some space is released in bottom tray.
+ * This space is taken into account for several consecutive calls for several buttons.
+ *
+ * @params[in] processed_object_type - type of button to be hide.
+ * @params[in, out] required_width - reference to required width to be released. This is a negative value.
+ * Its absolute value is decreased by panel width.
+ * @params[in, out] buttons_freed_width - reference to value released over required one.
+ * If panel's width is more than required difference is added to buttons_freed_width.
+ */
+ void processHideButton(EResizeState processed_object_type, S32& required_width, S32& buttons_freed_width);
/**
* Shrinks shown buttons to reduce total taken space.
*
- * @param - required_width - width which buttons can use to be shrunk. It is a negative value.
+ * Shrinks buttons that may be shrunk smoothly first. Then shrinks Speak button.
+ *
+ * @param[in, out] required_width - reference to width value which should be released when buttons are shrunk. It is a negative value.
* It is increased on the value processed by buttons.
+ * @params[in, out] buttons_freed_width - reference to value released over required one.
+ * If width of panel with Speak button is more than required that difference is added
+ * to buttons_freed_width.
+ * This is because Speak button shrinks discretely unlike other buttons which are changed smoothly.
+ */
+ void processShrinkButtons(S32& required_width, S32& buttons_freed_width);
+
+ /**
+ * Shrinks panel with specified button if it is visible.
+ *
+ * @params[in] processed_object_type - type of button to be shrunk.
+ * @param[in, out] required_width - reference to width value which should be released when button is shrunk. It is a negative value.
+ * It is increased on the value released by the button.
*/
- void processShrinkButtons(S32* required_width, S32* buttons_freed_width);
- void processShrinkButton(EResizeState processed_object_type, S32* required_width);
+ void processShrinkButton(EResizeState processed_object_type, S32& required_width);
/**
* Extends shown buttons to increase total taken space.
*
- * @param - available_width - width which buttons can use to be extended. It is a positive value.
- * It is decreased on the value processed by buttons.
+ * Extends buttons that may be extended smoothly first. Then extends Speak button.
+ *
+ * @param[in, out] available_width - reference to width value which buttons can use to be extended.
+ * It is a positive value. It is decreased on the value processed by buttons.
+ */
+ void processExtendButtons(S32& available_width);
+
+ /**
+ * Extends shown button to increase total taken space.
+ *
+ * @params[in] processed_object_type - type of button to be extended.
+ * @param[in, out] available_width - reference to width value which button can use to be extended.
+ * It is a positive value. It is decreased on the value processed by buttons.
*/
- void processExtendButtons(S32* available_width);
- void processExtendButton(EResizeState processed_object_type, S32* available_width);
+ void processExtendButton(EResizeState processed_object_type, S32& available_width);
/**
* Determines if specified by type object can be shown. It should be hidden by shrink before.
@@ -159,7 +261,15 @@ private:
* - Gestures, Move, View, Snapshot
*/
bool canButtonBeShown(EResizeState processed_object_type) const;
- void initStateProcessedObjectMap();
+
+ /**
+ * Initializes all containers stored data related to children resize state.
+ *
+ * @see mStateProcessedObjectMap
+ * @see mObjectDefaultWidthMap
+ * @see mButtonsProcessOrder
+ */
+ void initResizeStateContainers();
/**
* Sets passed visibility to object specified by resize type.
@@ -205,8 +315,12 @@ private:
typedef std::map<EResizeState, S32> state_object_width_map_t;
state_object_width_map_t mObjectDefaultWidthMap;
- typedef std::map<EResizeState, LLUICtrl*> dummies_map_t;
- dummies_map_t mDummiesMap;
+ typedef std::vector<EResizeState> resize_state_vec_t;
+
+ /**
+ * Contains order in which child buttons should be processed in show/hide, extend/shrink methods.
+ */
+ resize_state_vec_t mButtonsProcessOrder;
protected:
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 5a96613870..dd99c6564c 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -133,7 +133,7 @@ LLCallFloater::~LLCallFloater()
if(LLVoiceClient::instanceExists())
{
- LLVoiceClient::instance().removeObserver(this);
+ LLVoiceClient::getInstance()->removeObserver(this);
}
LLTransientFloaterMgr::getInstance()->removeControlView(this);
}
@@ -207,7 +207,6 @@ void LLCallFloater::draw()
void LLCallFloater::onChange()
{
if (NULL == mParticipants) return;
-
updateParticipantsVoiceState();
// Add newly joined participants.
@@ -237,11 +236,11 @@ void LLCallFloater::updateSession()
LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
if (voice_channel)
{
- lldebugs << "Current voice channel: " << voice_channel->getSessionID() << llendl;
+ LL_DEBUGS("Voice") << "Current voice channel: " << voice_channel->getSessionID() << LL_ENDL;
if (mSpeakerManager && voice_channel->getSessionID() == mSpeakerManager->getSessionID())
{
- lldebugs << "Speaker manager is already set for session: " << voice_channel->getSessionID() << llendl;
+ LL_DEBUGS("Voice") << "Speaker manager is already set for session: " << voice_channel->getSessionID() << LL_ENDL;
return;
}
else
@@ -251,7 +250,6 @@ void LLCallFloater::updateSession()
}
const LLUUID& session_id = voice_channel ? voice_channel->getSessionID() : LLUUID::null;
- lldebugs << "Set speaker manager for session: " << session_id << llendl;
LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
if (im_session)
@@ -291,7 +289,7 @@ void LLCallFloater::updateSession()
{
// by default let show nearby chat participants
mSpeakerManager = LLLocalSpeakerMgr::getInstance();
- lldebugs << "Set DEFAULT speaker manager" << llendl;
+ LL_DEBUGS("Voice") << "Set DEFAULT speaker manager" << LL_ENDL;
mVoiceType = VC_LOCAL_CHAT;
}
@@ -470,16 +468,15 @@ void LLCallFloater::updateAgentModeratorState()
static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids)
{
// Get a list of participants from VoiceClient
- LLVoiceClient::participantMap *voice_map = LLVoiceClient::getInstance()->getParticipantList();
- if (voice_map)
+ std::set<LLUUID> participants;
+ LLVoiceClient::getInstance()->getParticipantList(participants);
+
+ for (std::set<LLUUID>::const_iterator iter = participants.begin();
+ iter != participants.end(); ++iter)
{
- for (LLVoiceClient::participantMap::const_iterator iter = voice_map->begin();
- iter != voice_map->end(); ++iter)
- {
- LLUUID id = (*iter).second->mAvatarID;
- speakers_uuids.push_back(id);
- }
+ speakers_uuids.push_back(*iter);
}
+
}
void LLCallFloater::initParticipantsVoiceState()
@@ -555,7 +552,7 @@ void LLCallFloater::updateParticipantsVoiceState()
uuid_vec_t::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id);
- lldebugs << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << llendl;
+ LL_DEBUGS("Voice") << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << LL_ENDL;
// If an avatarID assigned to a panel is found in a speakers list
// obtained from VoiceClient we assign the JOINED status to the owner
@@ -728,7 +725,7 @@ void LLCallFloater::connectToChannel(LLVoiceChannel* channel)
void LLCallFloater::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
{
// check is voice operational and if it doesn't work hide VCP (EXT-4397)
- if(LLVoiceClient::voiceEnabled() && LLVoiceClient::getInstance()->voiceWorking())
+ if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
{
updateState(new_state);
}
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 79a2631c31..1a6c11fa73 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -700,6 +700,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
args["FIRST"] = first;
args["LAST"] = last;
}
+
}
}
else
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 68c31d87fa..31feabe722 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -647,20 +647,19 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
{
// for object IMs, create a secondlife:///app/objectim SLapp
- std::string url = LLSLURL::buildCommand("objectim", chat.mFromID, "");
+ std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString();
url += "?name=" + chat.mFromName;
url += "&owner=" + args["owner_id"].asString();
std::string slurl = args["slurl"].asString();
if (slurl.empty())
{
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
- if (region)
- {
- S32 x, y, z;
- LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z);
- slurl = region->getName() + llformat("/%d/%d/%d", x, y, z);
- }
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
+ if(region)
+ {
+ LLSLURL region_slurl(region->getName(), chat.mPosAgent);
+ slurl = region_slurl.getLocationString();
+ }
}
url += "&slurl=" + slurl;
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index 6ee14e8ba9..5b6a99e793 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -192,7 +192,7 @@ void LLNearbyChatToastPanel::init(LLSD& notification)
style_params_name.font.name(font_name);
style_params_name.font.size(font_style_size);
- style_params_name.link_href = LLSLURL::buildCommand("agent",mFromID,"about");
+ style_params_name.link_href = LLSLURL("agent",mFromID,"about").getSLURLString();
msg_text->appendText(str_sender, FALSE, style_params_name);
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index 9c4aa7b964..6897f4ee8e 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -183,20 +183,6 @@ void LLSysWellChiclet::setCounter(S32 counter)
mButton->setLabel(s_count);
- setNewMessagesState(counter > mCounter);
-
- // we have to flash to 'Lit' state each time new unread message is coming.
- if (counter > mCounter)
- {
- mFlashToLitTimer->flash();
- }
- else if (counter == 0)
- {
- // if notification is resolved while well is flashing it can leave in the 'Lit' state
- // when flashing finishes itself. Let break flashing here.
- mFlashToLitTimer->stopFlashing();
- }
-
mCounter = counter;
}
@@ -316,7 +302,26 @@ void LLIMWellChiclet::createMenu()
void LLIMWellChiclet::messageCountChanged(const LLSD& session_data)
{
- setCounter(LLBottomTray::getInstance()->getTotalUnreadIMCount());
+ const LLUUID& session_id = session_data["session_id"];
+ const S32 counter = LLBottomTray::getInstance()->getTotalUnreadIMCount();
+ const bool im_not_visible = !LLFloaterReg::instanceVisible("im_container")
+ && !LLFloaterReg::instanceVisible("impanel", session_id);
+
+ setNewMessagesState(counter > mCounter && im_not_visible);
+
+ // we have to flash to 'Lit' state each time new unread message is coming.
+ if (counter > mCounter && im_not_visible)
+ {
+ mFlashToLitTimer->flash();
+ }
+ else if (counter == 0)
+ {
+ // if notification is resolved while well is flashing it can leave in the 'Lit' state
+ // when flashing finishes itself. Let break flashing here.
+ mFlashToLitTimer->stopFlashing();
+ }
+
+ setCounter(counter);
}
/************************************************************************/
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 1925b818f2..8d4430a9ea 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -46,6 +46,20 @@ static LLRegisterPanelClassWrapper<LLCOFWearables> t_cof_wearables("cof_wearable
const LLSD REARRANGE = LLSD().with("rearrange", LLSD());
+static const LLWearableItemNameComparator WEARABLE_NAME_COMPARATOR;
+
+
+bool LLWearableItemNameComparator::doCompare(const LLPanelWearableListItem* wearable_item1, const LLPanelWearableListItem* wearable_item2) const
+{
+ std::string name1 = wearable_item1->getItemName();
+ std::string name2 = wearable_item2->getItemName();
+
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
+
+ return name1 < name2;
+}
+
LLCOFWearables::LLCOFWearables() : LLPanel(),
mAttachments(NULL),
@@ -73,6 +87,10 @@ BOOL LLCOFWearables::postBuild()
mClothing->setCommitOnSelectionChange(true);
mBodyParts->setCommitOnSelectionChange(true);
+ //clothing is sorted according to its position relatively to the body
+ mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR);
+ mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR);
+
return LLPanel::postBuild();
}
@@ -114,7 +132,7 @@ void LLCOFWearables::refresh()
populateAttachmentsAndBodypartsLists(cof_items);
- LLAppearanceMgr::wearables_by_type_t clothing_by_type(WT_COUNT);
+ LLAppearanceMgr::wearables_by_type_t clothing_by_type(LLWearableType::WT_COUNT);
LLAppearanceMgr::getInstance()->divvyWearablesByType(cof_items, clothing_by_type);
populateClothingList(clothing_by_type);
@@ -150,7 +168,7 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel
LLPanelInventoryListItemBase* item_panel = NULL;
if (item_type == LLAssetType::AT_OBJECT)
{
- item_panel = LLPanelInventoryListItemBase::create(item);
+ item_panel = buildAttachemntListItem(item);
mAttachments->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
}
else if (item_type == LLAssetType::AT_BODYPART)
@@ -164,16 +182,15 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel
if (mAttachments->size())
{
- mAttachments->sort(); //*TODO by Name
+ mAttachments->sort();
mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
}
if (mBodyParts->size())
{
- mBodyParts->sort(); //*TODO by name
+ mBodyParts->sort();
+ mBodyParts->notify(REARRANGE);
}
-
- mBodyParts->notify(REARRANGE);
}
//create a clothing list item, update verbs and show/hide line separator
@@ -199,8 +216,8 @@ LLPanelClothingListItem* LLCOFWearables::buildClothingListItem(LLViewerInventory
//setting callbacks
//*TODO move that item panel's inner structure disclosing stuff into the panels
item_panel->childSetAction("btn_delete", mCOFCallbacks.mDeleteWearable);
- item_panel->childSetAction("btn_move_up", mCOFCallbacks.mMoveWearableCloser);
- item_panel->childSetAction("btn_move_down", mCOFCallbacks.mMoveWearableFurther);
+ item_panel->childSetAction("btn_move_up", mCOFCallbacks.mMoveWearableFurther);
+ item_panel->childSetAction("btn_move_down", mCOFCallbacks.mMoveWearableCloser);
item_panel->childSetAction("btn_edit", mCOFCallbacks.mEditWearable);
//turning on gray separator line for the last item in the items group of the same wearable type
@@ -232,22 +249,38 @@ LLPanelBodyPartsListItem* LLCOFWearables::buildBodypartListItem(LLViewerInventor
return item_panel;
}
+LLPanelDeletableWearableListItem* LLCOFWearables::buildAttachemntListItem(LLViewerInventoryItem* item)
+{
+ llassert(item);
+ if (!item) return NULL;
+
+ LLPanelDeletableWearableListItem* item_panel = LLPanelDeletableWearableListItem::create(item);
+ if (!item_panel) return NULL;
+
+ //setting callbacks
+ //*TODO move that item panel's inner structure disclosing stuff into the panels
+ item_panel->childSetAction("btn_delete", mCOFCallbacks.mDeleteWearable);
+
+ return item_panel;
+}
+
void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type)
{
- llassert(clothing_by_type.size() == WT_COUNT);
+ llassert(clothing_by_type.size() == LLWearableType::WT_COUNT);
- for (U32 type = WT_SHIRT; type < WT_COUNT; ++type)
+ for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; ++type)
{
U32 size = clothing_by_type[type].size();
if (!size) continue;
LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]);
- for (U32 i = 0; i < size; i++)
+ //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body)
+ for (U32 i = size; i != 0; --i)
{
- LLViewerInventoryItem* item = clothing_by_type[type][i];
+ LLViewerInventoryItem* item = clothing_by_type[type][i-1];
- LLPanelClothingListItem* item_panel = buildClothingListItem(item, i == 0, i == size - 1);
+ LLPanelClothingListItem* item_panel = buildClothingListItem(item, i == size, i == 1);
if (!item_panel) continue;
mClothing->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
@@ -262,14 +295,14 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t&
//adding dummy items for missing wearable types
void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type)
{
- llassert(clothing_by_type.size() == WT_COUNT);
+ llassert(clothing_by_type.size() == LLWearableType::WT_COUNT);
- for (U32 type = WT_SHIRT; type < WT_COUNT; type++)
+ for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++)
{
U32 size = clothing_by_type[type].size();
if (size) continue;
- EWearableType w_type = static_cast<EWearableType>(type);
+ LLWearableType::EType w_type = static_cast<LLWearableType::EType>(type);
LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type);
if(!item_panel) continue;
mClothing->addItem(item_panel, LLUUID::null, ADD_BOTTOM, false);
diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h
index 2d26bf781f..612bb103d2 100644
--- a/indra/newview/llcofwearables.h
+++ b/indra/newview/llcofwearables.h
@@ -40,6 +40,53 @@
class LLFlatListView;
+
+/** Abstract comparator of wearable list items */
+class LLWearableListItemComparator : public LLFlatListView::ItemComparator
+{
+ LOG_CLASS(LLWearableListItemComparator);
+
+public:
+ LLWearableListItemComparator() {};
+ virtual ~LLWearableListItemComparator() {};
+
+ virtual bool compare(const LLPanel* item1, const LLPanel* item2) const
+ {
+ const LLPanelWearableListItem* wearable_item1 = dynamic_cast<const LLPanelWearableListItem*>(item1);
+ const LLPanelWearableListItem* wearable_item2 = dynamic_cast<const LLPanelWearableListItem*>(item2);
+
+ if (!wearable_item1 || !wearable_item2)
+ {
+ llwarning("item1 and item2 cannot be null", 0);
+ return true;
+ }
+
+ return doCompare(wearable_item1, wearable_item2);
+ }
+
+protected:
+
+ /**
+ * Returns true if wearable_item1 < wearable_item2, false otherwise
+ * Implement this method in your particular comparator.
+ */
+ virtual bool doCompare(const LLPanelWearableListItem* wearable_item1, const LLPanelWearableListItem* wearable_item2) const = 0;
+};
+
+
+class LLWearableItemNameComparator : public LLWearableListItemComparator
+{
+ LOG_CLASS(LLWearableItemNameComparator);
+
+public:
+ LLWearableItemNameComparator() {};
+ virtual ~LLWearableItemNameComparator() {};
+
+protected:
+ virtual bool doCompare(const LLPanelWearableListItem* wearable_item1, const LLPanelWearableListItem* wearable_item2) const;
+};
+
+
/**
* Adaptor between LLAccordionCtrlTab and LLFlatListView to facilitate communication between them
* (notify, notifyParent) regarding size changes of a list and selection changes across accordion tabs.
@@ -132,6 +179,7 @@ protected:
LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last);
LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item);
+ LLPanelDeletableWearableListItem* buildAttachemntListItem(LLViewerInventoryItem* item);
LLFlatListView* mAttachments;
LLFlatListView* mClothing;
diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp
index be6c15eab4..fd3df359bd 100644
--- a/indra/newview/llcurrencyuimanager.cpp
+++ b/indra/newview/llcurrencyuimanager.cpp
@@ -284,7 +284,7 @@ void LLCurrencyUIManager::Impl::startTransaction(TransactionType type,
static std::string transactionURI;
if (transactionURI.empty())
{
- transactionURI = LLViewerLogin::getInstance()->getHelperURI() + "currency.php";
+ transactionURI = LLGridManager::getInstance()->getHelperURI() + "currency.php";
}
delete mTransaction;
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index ebd767d654..40ce0ebcf4 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -534,7 +534,7 @@ void LLDriverParam::resetDrivenParams()
mDriven.reserve(getInfo()->mDrivenInfoList.size());
}
-void LLDriverParam::updateCrossDrivenParams(EWearableType driven_type)
+void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
{
bool needs_update = (getWearableType()==driven_type);
@@ -551,7 +551,7 @@ void LLDriverParam::updateCrossDrivenParams(EWearableType driven_type)
if (needs_update)
{
- EWearableType driver_type = (EWearableType)getWearableType();
+ LLWearableType::EType driver_type = (LLWearableType::EType)getWearableType();
// If we've gotten here, we've added a new wearable of type "type"
// Thus this wearable needs to get updates from the driver wearable.
diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h
index e963a2d55a..1069f7ad51 100644
--- a/indra/newview/lldriverparam.h
+++ b/indra/newview/lldriverparam.h
@@ -34,7 +34,7 @@
#define LL_LLDRIVERPARAM_H
#include "llviewervisualparam.h"
-#include "llwearabledictionary.h"
+#include "llwearabletype.h"
class LLVOAvatar;
class LLWearable;
@@ -94,7 +94,7 @@ public:
void setWearable(LLWearable *wearablep);
void setAvatar(LLVOAvatar *avatarp);
- void updateCrossDrivenParams(EWearableType driven_type);
+ void updateCrossDrivenParams(LLWearableType::EType driven_type);
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index ef69f39ad2..56bc4a7933 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -266,8 +266,18 @@ LLSD LLFloaterAbout::getInfo()
info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
bool want_fullname = true;
info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
- info["VIVOX_VERSION"] = gVoiceClient ? gVoiceClient->getAPIVersion() : LLTrans::getString("NotConnected");
-
+ if(LLVoiceClient::getInstance()->voiceEnabled())
+ {
+ LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
+ std::ostringstream version_string;
+ version_string << version.serverType << " " << version.serverVersion << std::endl;
+ info["VOICE_VERSION"] = version_string.str();
+ }
+ else
+ {
+ info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
+ }
+
// TODO: Implement media plugin version query
info["QT_WEBKIT_VERSION"] = "4.6 (version number hard-coded)";
diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp
index deef85cc6c..fd392d949a 100644
--- a/indra/newview/llfloateravatartextures.cpp
+++ b/indra/newview/llfloateravatartextures.cpp
@@ -84,7 +84,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
{
if (avatarp->isSelf())
{
- const EWearableType wearable_type = tex_entry->mWearableType;
+ const LLWearableType::EType wearable_type = tex_entry->mWearableType;
LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
if (wearable)
{
@@ -175,7 +175,7 @@ void LLFloaterAvatarTextures::onClickDump(void* data)
if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i))
{
LLUUID id = IMG_DEFAULT_AVATAR;
- EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
+ LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
if (avatarp->isSelf())
{
LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index 44c82f1941..46b3695511 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -43,7 +43,7 @@
#include "llagent.h" // for agent id
#include "llinventorymodel.h" // for gInventory
#include "llfloaterreg.h"
-#include "llfloaterinventory.h" // for get_item_icon
+#include "llinventoryicon.h"
#include "llinventorydefines.h"
#include "llinventoryfunctions.h"
#include "llnotificationsutil.h"
@@ -152,9 +152,8 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
LLSD row;
// Compute icon for this item
- std::string icon_name = get_item_icon_name(LLAssetType::AT_OBJECT,
- LLInventoryType::IT_OBJECT,
- 0x0, FALSE);
+ std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT,
+ LLInventoryType::IT_OBJECT);
row["columns"][0]["column"] = "icon";
row["columns"][0]["type"] = "icon";
@@ -253,8 +252,9 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
item_is_multi = TRUE;
}
- std::string icon_name = get_item_icon_name(inv_item->getType(),
+ std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
inv_item->getInventoryType(),
+ inv_item->getIsLinkType(),
inv_item->getFlags(),
item_is_multi);
row["columns"][0]["column"] = "icon";
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 1d989ad0fd..c35653178a 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -48,7 +48,7 @@
#include "llinventoryfunctions.h"
#include "llinventorymodel.h" // for gInventory
#include "llfloaterreg.h"
-#include "llfloaterinventory.h" // for get_item_icon
+#include "llfloaterinventory.h" // for LLInventoryIcon::getIcon
#include "llnotificationsutil.h"
#include "llselectmgr.h"
#include "llscrolllistctrl.h"
@@ -221,8 +221,9 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
item_is_multi = TRUE;
}
- std::string icon_name = get_item_icon_name(inv_item->getType(),
+ std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
inv_item->getInventoryType(),
+ inv_item->getIsLinkType(),
inv_item->getFlags(),
item_is_multi);
row["columns"][0]["column"] = "icon";
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 76a61db5fd..7ca7ace0fc 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -831,7 +831,7 @@ void LLFloaterBuyLandUI::updateNames()
else
{
mParcelSellerName =
- LLSLURL::buildCommand("agent", parcelp->getOwnerID(), "inspect");
+ LLSLURL("agent", parcelp->getOwnerID(), "inspect").getSLURLString();
}
}
@@ -860,7 +860,7 @@ void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCVa
static std::string transaction_uri;
if (transaction_uri.empty())
{
- transaction_uri = LLViewerLogin::getInstance()->getHelperURI() + "landtool.php";
+ transaction_uri = LLGridManager::getInstance()->getHelperURI() + "landtool.php";
}
const char* method;
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index cdb9b8edb8..882d12f68e 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -166,7 +166,7 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4&
if (chat.mSourceType == CHAT_SOURCE_AGENT &&
chat.mFromID != LLUUID::null)
{
- chat.mURL = LLSLURL::buildCommand("agent", chat.mFromID, "inspect");
+ chat.mURL = LLSLURL("agent", chat.mFromID, "inspect").getSLURLString();
}
// If the chat line has an associated url, link it up to the name.
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index 774caaec90..a15cef7ea4 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -318,7 +318,7 @@ LLFloaterChatterBox* LLFloaterChatterBox::getInstance()
//static
LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
{
- if (!LLVoiceClient::voiceEnabled())
+ if (!LLVoiceClient::getInstance()->voiceEnabled())
{
return NULL;
}
diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index 560cc29080..f6cffd4b14 100644
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -192,7 +192,7 @@ void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **)
floater->mTBCategory->setText(floater->mEventInfo.mCategoryStr);
floater->mTBDate->setText(floater->mEventInfo.mTimeStr);
floater->mTBDesc->setText(floater->mEventInfo.mDesc);
- floater->mTBRunBy->setText(LLSLURL::buildCommand("agent", floater->mEventInfo.mRunByID, "inspect"));
+ floater->mTBRunBy->setText(LLSLURL("agent", floater->mEventInfo.mRunByID, "inspect").getSLURLString());
floater->mTBDuration->setText(llformat("%d:%.2d", floater->mEventInfo.mDuration / 60, floater->mEventInfo.mDuration % 60));
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 2ff483cd34..256796aa80 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -42,7 +42,6 @@
#include "llnotificationsutil.h"
#include "llparcel.h"
#include "message.h"
-#include "lluserauth.h"
#include "llagent.h"
#include "llbutton.h"
@@ -805,7 +804,7 @@ void LLPanelLandGeneral::refreshNames()
else
{
// Figure out the owner's name
- owner = LLSLURL::buildCommand("agent", parcel->getOwnerID(), "inspect");
+ owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
}
if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
@@ -817,7 +816,7 @@ void LLPanelLandGeneral::refreshNames()
std::string group;
if (!parcel->getGroupID().isNull())
{
- group = LLSLURL::buildCommand("group", parcel->getGroupID(), "inspect");
+ group = LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
}
mTextGroup->setText(group);
@@ -826,9 +825,9 @@ void LLPanelLandGeneral::refreshNames()
const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
if(auth_buyer_id.notNull())
{
- std::string name;
- name = LLSLURL::buildCommand("agent", auth_buyer_id, "inspect");
- mSaleInfoForSale2->setTextArg("[BUYER]", name);
+ std::string name;
+ name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString();
+ mSaleInfoForSale2->setTextArg("[BUYER]", name);
}
else
{
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 2ab83eab79..0eeef0039c 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -599,7 +599,7 @@ void LLFloaterPreference::onBtnOK()
llinfos << "Can't close preferences!" << llendl;
}
- LLPanelLogin::refreshLocation( false );
+ LLPanelLogin::updateLocationCombo( false );
}
// static
@@ -616,7 +616,7 @@ void LLFloaterPreference::onBtnApply( )
apply();
saveSettings();
- LLPanelLogin::refreshLocation( false );
+ LLPanelLogin::updateLocationCombo( false );
}
// static
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 3758cbe74f..8c219cb3fd 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -2922,8 +2922,7 @@ bool LLDispatchEstateUpdateInfo::operator()(
LLUUID owner_id(strings[1]);
regionp->setOwner(owner_id);
// Update estate owner name in UI
- std::string owner_name =
- LLSLURL::buildCommand("agent", owner_id, "inspect");
+ std::string owner_name = LLSLURL("agent", owner_id, "inspect").getSLURLString();
panel->setOwnerName(owner_name);
U32 estate_id = strtoul(strings[2].c_str(), NULL, 10);
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index b42b34835d..f7c8855bf6 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -126,7 +126,9 @@ void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg)
// virtual
BOOL LLFloaterReporter::postBuild()
{
- childSetText("abuse_location_edit", LLAgentUI::buildSLURL());
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl);
+ childSetText("abuse_location_edit", slurl.getSLURLString());
enableControls(TRUE);
@@ -280,7 +282,6 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
{
object_owner.append("Unknown");
}
-
setFromAvatar(mObjectID, object_owner);
}
else
@@ -325,7 +326,8 @@ void LLFloaterReporter::setFromAvatar(const LLUUID& avatar_id, const std::string
mAbuserID = mObjectID = avatar_id;
mOwnerName = avatar_name;
- std::string avatar_link = LLSLURL::buildCommand("agent", mObjectID, "inspect");
+ std::string avatar_link =
+ LLSLURL("agent", mObjectID, "inspect").getSLURLString();
childSetText("owner_name", avatar_link);
childSetText("object_name", avatar_name);
childSetText("abuser_name_edit", avatar_name);
@@ -504,7 +506,7 @@ void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name
{
childSetText("object_name", object_name);
std::string owner_link =
- LLSLURL::buildCommand("agent", owner_id, "inspect");
+ LLSLURL("agent", owner_id, "inspect").getSLURLString();
childSetText("owner_name", owner_link);
childSetText("abuser_name_edit", owner_name);
mAbuserID = owner_id;
@@ -566,7 +568,7 @@ LLSD LLFloaterReporter::gatherReport()
mCopyrightWarningSeen = FALSE;
std::ostringstream summary;
- if (!LLViewerLogin::getInstance()->isInProductionGrid())
+ if (!LLGridManager::getInstance()->isInProductionGrid())
{
summary << "Preview ";
}
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index 980b456497..9dddbd998a 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -94,7 +94,6 @@ private:
static void doSellLand(void *userdata);
bool onConfirmSale(const LLSD& notification, const LLSD& response);
static void doShowObjects(void *userdata);
- static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids);
@@ -102,6 +101,7 @@ public:
virtual BOOL postBuild();
bool setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
+ static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
};
// static
@@ -423,11 +423,13 @@ void LLFloaterSellLandUI::doShowObjects(void *userdata)
send_parcel_select_objects(parcel->getLocalID(), RT_SELL);
+ // we shouldn't pass callback functor since it is registered in LLFunctorRegistration
LLNotificationsUtil::add("TransferObjectsHighlighted",
- LLSD(), LLSD(),
- &LLFloaterSellLandUI::callbackHighlightTransferable);
+ LLSD(), LLSD());
}
+static LLNotificationFunctorRegistration tr("TransferObjectsHighlighted", &LLFloaterSellLandUI::callbackHighlightTransferable);
+
// static
bool LLFloaterSellLandUI::callbackHighlightTransferable(const LLSD& notification, const LLSD& data)
{
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index e994a18d9b..b9008fa53b 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1145,7 +1145,7 @@ void LLSnapshotLivePreview::saveWeb(std::string url)
void LLSnapshotLivePreview::regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z)
{
- body["slurl"] = LLSLURL::buildSLURL(name, x, y, z);
+ body["slurl"] = LLSLURL(name, LLVector3d(x, y, z)).getSLURLString();
LLHTTPClient::post(url, body,
new LLSendWebResponder());
diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp
index 002d417e4c..0e802e9736 100644
--- a/indra/newview/llfloaterurlentry.cpp
+++ b/indra/newview/llfloaterurlentry.cpp
@@ -70,11 +70,6 @@ public:
completeAny(status, mime_type);
}
- virtual void error( U32 status, const std::string& reason )
- {
- completeAny(status, LLMIMETypes::getDefaultMimeType());
- }
-
void completeAny(U32 status, const std::string& mime_type)
{
// Set empty type to none/none. Empty string is reserved for legacy parcels
diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp
index 638c9f1b8c..63365e3461 100644
--- a/indra/newview/llfloatervoicedevicesettings.cpp
+++ b/indra/newview/llfloatervoicedevicesettings.cpp
@@ -64,9 +64,6 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings()
// grab "live" mic volume level
mMicVolume = gSavedSettings.getF32("AudioLevelMic");
- // ask for new device enumeration
- // now do this in onOpen() instead...
- //gVoiceClient->refreshDeviceLists();
}
LLPanelVoiceDeviceSettings::~LLPanelVoiceDeviceSettings()
@@ -105,7 +102,7 @@ void LLPanelVoiceDeviceSettings::draw()
refresh();
// let user know that volume indicator is not yet available
- bool is_in_tuning_mode = gVoiceClient->inTuningMode();
+ bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
childSetVisible("wait_text", !is_in_tuning_mode);
LLPanel::draw();
@@ -113,7 +110,7 @@ void LLPanelVoiceDeviceSettings::draw()
if (is_in_tuning_mode)
{
const S32 num_bars = 5;
- F32 voice_power = gVoiceClient->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
+ F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f));
for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++)
@@ -194,13 +191,13 @@ void LLPanelVoiceDeviceSettings::refresh()
LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
// set mic volume tuning slider based on last mic volume setting
F32 current_volume = (F32)volume_slider->getValue().asReal();
- gVoiceClient->tuningSetMicVolume(current_volume);
+ LLVoiceClient::getInstance()->tuningSetMicVolume(current_volume);
// Fill in popup menus
mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
- if(!gVoiceClient->deviceSettingsAvailable())
+ if(!LLVoiceClient::getInstance()->deviceSettingsAvailable())
{
// The combo boxes are disabled, since we can't get the device settings from the daemon just now.
// Put the currently set default (ONLY) in the box, and select it.
@@ -219,17 +216,16 @@ void LLPanelVoiceDeviceSettings::refresh()
}
else if (!mDevicesUpdated)
{
- LLVoiceClient::deviceList *devices;
-
- LLVoiceClient::deviceList::iterator iter;
+ LLVoiceDeviceList::const_iterator iter;
if(mCtrlInputDevices)
{
mCtrlInputDevices->removeall();
mCtrlInputDevices->add( getString("default_text"), ADD_BOTTOM );
- devices = gVoiceClient->getCaptureDevices();
- for(iter=devices->begin(); iter != devices->end(); iter++)
+ for(iter=LLVoiceClient::getInstance()->getCaptureDevices().begin();
+ iter != LLVoiceClient::getInstance()->getCaptureDevices().end();
+ iter++)
{
mCtrlInputDevices->add( *iter, ADD_BOTTOM );
}
@@ -245,8 +241,8 @@ void LLPanelVoiceDeviceSettings::refresh()
mCtrlOutputDevices->removeall();
mCtrlOutputDevices->add( getString("default_text"), ADD_BOTTOM );
- devices = gVoiceClient->getRenderDevices();
- for(iter=devices->begin(); iter != devices->end(); iter++)
+ for(iter= LLVoiceClient::getInstance()->getRenderDevices().begin();
+ iter != LLVoiceClient::getInstance()->getRenderDevices().end(); iter++)
{
mCtrlOutputDevices->add( *iter, ADD_BOTTOM );
}
@@ -268,37 +264,34 @@ void LLPanelVoiceDeviceSettings::initialize()
mDevicesUpdated = FALSE;
// ask for new device enumeration
- gVoiceClient->refreshDeviceLists();
+ LLVoiceClient::getInstance()->refreshDeviceLists();
// put voice client in "tuning" mode
- gVoiceClient->tuningStart();
+ LLVoiceClient::getInstance()->tuningStart();
LLVoiceChannel::suspend();
}
void LLPanelVoiceDeviceSettings::cleanup()
{
- if (gVoiceClient)
- {
- gVoiceClient->tuningStop();
- }
+ LLVoiceClient::getInstance()->tuningStop();
LLVoiceChannel::resume();
}
// static
void LLPanelVoiceDeviceSettings::onCommitInputDevice(LLUICtrl* ctrl, void* user_data)
{
- if(gVoiceClient)
+ if(LLVoiceClient::getInstance())
{
- gVoiceClient->setCaptureDevice(ctrl->getValue().asString());
+ LLVoiceClient::getInstance()->setCaptureDevice(ctrl->getValue().asString());
}
}
// static
void LLPanelVoiceDeviceSettings::onCommitOutputDevice(LLUICtrl* ctrl, void* user_data)
{
- if(gVoiceClient)
+ if(LLVoiceClient::getInstance())
{
- gVoiceClient->setRenderDevice(ctrl->getValue().asString());
+ LLVoiceClient::getInstance()->setRenderDevice(ctrl->getValue().asString());
}
}
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index b3223ad494..152360a96e 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -461,7 +461,7 @@ void LLFloaterWorldMap::draw()
childSetEnabled("Teleport", (BOOL)tracking_status);
// childSetEnabled("Clear", (BOOL)tracking_status);
childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
- childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
+ childSetEnabled("copy_slurl", (mSLURL.isValid()) );
setMouseOpaque(TRUE);
getDragHandle()->setMouseOpaque(TRUE);
@@ -660,14 +660,8 @@ void LLFloaterWorldMap::updateLocation()
childSetValue("location", agent_sim_name);
// Figure out where user is
- LLVector3d agentPos = gAgent.getPositionGlobal();
-
- S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
- S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
- S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
-
// Set the current SLURL
- mSLURL = LLSLURL::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z);
+ mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
}
}
@@ -694,18 +688,15 @@ void LLFloaterWorldMap::updateLocation()
}
childSetValue("location", sim_name);
-
- F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
- F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
if ( gotSimName )
{
- mSLURL = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]));
+ mSLURL = LLSLURL(sim_name, pos_global);
}
else
{ // Empty SLURL will disable the "Copy SLURL to clipboard" button
- mSLURL = "";
+ mSLURL = LLSLURL();
}
}
}
@@ -1174,7 +1165,7 @@ void LLFloaterWorldMap::onClearBtn()
mTrackedStatus = LLTracker::TRACKING_NOTHING;
LLTracker::stopTracking((void *)(intptr_t)TRUE);
LLWorldMap::getInstance()->cancelTracking();
- mSLURL = ""; // Clear the SLURL since it's invalid
+ mSLURL = LLSLURL(); // Clear the SLURL since it's invalid
mSetToUserPosition = TRUE; // Revert back to the current user position
}
@@ -1197,10 +1188,10 @@ void LLFloaterWorldMap::onClickTeleportBtn()
void LLFloaterWorldMap::onCopySLURL()
{
- getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL));
+ getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString()));
LLSD args;
- args["SLURL"] = mSLURL;
+ args["SLURL"] = mSLURL.getSLURLString();
LLNotificationsUtil::add("CopySLURL", args);
}
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 00f5e788fb..52809ff830 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -43,6 +43,7 @@
#include "llhudtext.h"
#include "llmapimagetype.h"
#include "lltracker.h"
+#include "llslurl.h"
class LLEventInfo;
class LLFriendObserver;
@@ -183,7 +184,7 @@ private:
LLTracker::ETrackingStatus mTrackedStatus;
std::string mTrackedSimName;
std::string mTrackedAvatarName;
- std::string mSLURL;
+ LLSLURL mSLURL;
};
extern LLFloaterWorldMap* gFloaterWorldMap;
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index eba4cdfa31..2ae11aa2b5 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -846,16 +846,16 @@ void LLFolderView::clearSelection()
mSelectThisID.setNull();
}
-BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection) const
+std::set<LLUUID> LLFolderView::getSelectionList() const
{
+ std::set<LLUUID> selection;
for (selected_items_t::const_iterator item_it = mSelectedItems.begin();
item_it != mSelectedItems.end();
++item_it)
{
selection.insert((*item_it)->getListener()->getUUID());
}
-
- return (selection.size() != 0);
+ return selection;
}
BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source)
@@ -2070,8 +2070,7 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
}
- std::set<LLUUID> selected_items;
- getSelectionList(selected_items);
+ std::set<LLUUID> selected_items = getSelectionList();
LLMultiPreview* multi_previewp = NULL;
LLMultiProperties* multi_propertiesp = NULL;
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 874723bb1a..0dfdbd364b 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -164,7 +164,7 @@ public:
virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
- virtual BOOL getSelectionList(std::set<LLUUID> &selection) const;
+ virtual std::set<LLUUID> getSelectionList() const;
// make sure if ancestor is selected, descendents are not
void sanitizeSelection();
@@ -230,6 +230,7 @@ public:
EAcceptance* accept,
std::string& tooltip_msg);
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) { setShowSelectionContext(FALSE); }
virtual void draw();
virtual void deleteAllChildren();
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 3208218302..54e9bd5383 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -387,6 +387,12 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection)
getRoot()->extendSelection(selection, NULL, selected_items);
}
+std::set<LLUUID> LLFolderViewItem::getSelectionList() const
+{
+ std::set<LLUUID> selection;
+ return selection;
+}
+
EInventorySortGroup LLFolderViewItem::getSortGroup() const
{
return SG_ITEM;
@@ -836,6 +842,7 @@ void LLFolderViewItem::draw()
static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
static LLUIColor sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE);
+ static LLUIColor sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
@@ -965,6 +972,8 @@ void LLFolderViewItem::draw()
}
LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
+ const LLViewerInventoryItem *item = getInventoryItem();
+ if (item && item->getIsLinkType()) color = sLinkColor;
if (in_library) color = sLibraryColor;
F32 right_x = 0;
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index 655ad89e99..57c722afa4 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -231,7 +231,7 @@ public:
virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items){ return FALSE; }
// gets multiple-element selection
- virtual BOOL getSelectionList(std::set<LLUUID> &selection) const {return TRUE;}
+ virtual std::set<LLUUID> getSelectionList() const;
// Returns true is this object and all of its children can be removed (deleted by user)
virtual BOOL isRemovable();
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 252c34cf9c..3224ac6d9b 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -40,12 +40,12 @@
#include "llmenugl.h"
#include "lltextbox.h"
#include "lltrans.h"
+#include "lluitextutil.h"
// newview
#include "llagent.h"
#include "llgroupactions.h"
#include "llfloaterreg.h"
-#include "lltextutil.h"
#include "llviewercontrol.h" // for gSavedSettings
#include "llviewermenu.h" // for gMenuHolder
#include "llvoiceclient.h"
@@ -273,7 +273,7 @@ bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
return gAgent.getGroupID() != selected_group_id;
if (userdata.asString() == "call")
- return real_group_selected && LLVoiceClient::voiceEnabled()&&gVoiceClient->voiceWorking();
+ return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
return real_group_selected;
}
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index c0cc3f1985..3aa9d75bc0 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -59,7 +59,6 @@
#include "lltransientfloatermgr.h"
#include "llinventorymodel.h"
#include "llrootview.h"
-
#include "llspeakers.h"
@@ -1105,6 +1104,21 @@ void LLIMFloater::closeHiddenIMToasts()
channel->closeHiddenToasts(IMToastMatcher());
}
}
+// static
+void LLIMFloater::confirmLeaveCallCallback(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ const LLSD& payload = notification["payload"];
+ LLUUID session_id = payload["session_id"];
+
+ LLFloater* im_floater = LLFloaterReg::findInstance("impanel", session_id);
+ if (option == 0 && im_floater != NULL)
+ {
+ im_floater->closeFloater();
+ }
+
+ return;
+}
// static
bool LLIMFloater::isChatMultiTab()
@@ -1155,3 +1169,31 @@ void LLIMFloater::onIMChicletCreated( const LLUUID& session_id )
}
}
+
+void LLIMFloater::onClickCloseBtn()
+{
+
+ LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
+ mSessionID);
+
+ if (session == NULL)
+ {
+ llwarns << "Empty session." << llendl;
+ return;
+ }
+
+ bool is_call_with_chat = session->isGroupSessionType()
+ || session->isAdHocSessionType() || session->isP2PSessionType();
+
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
+
+ if (is_call_with_chat && voice_channel != NULL && voice_channel->isActive())
+ {
+ LLSD payload;
+ payload["session_id"] = mSessionID;
+ LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback);
+ return;
+ }
+
+ LLFloater::onClickCloseBtn();
+}
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index f9dd8b9b85..fef178e3a2 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -50,6 +50,7 @@ class LLInventoryCategory;
*/
class LLIMFloater : public LLTransientDockableFloater
{
+ LOG_CLASS(LLIMFloater);
public:
LLIMFloater(const LLUUID& session_id);
@@ -120,6 +121,10 @@ public:
virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::IM; }
+protected:
+ /* virtual */
+ void onClickCloseBtn();
+
private:
// process focus events to set a currently active session
/* virtual */ void onFocusLost();
@@ -150,6 +155,8 @@ private:
static void closeHiddenIMToasts();
+ static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
+
LLPanelChatControlPanel* mControlPanel;
LLUUID mSessionID;
S32 mLastMessageIndex;
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 4bdf5f42dc..0e3b78df7f 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -300,7 +300,7 @@ void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
if (floaterp)
{
- gVoiceClient->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
+ LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
}
}
@@ -312,7 +312,7 @@ void LLFloaterIMPanel::draw()
BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
&& mSessionInitialized
- && LLVoiceClient::voiceEnabled()
+ && LLVoiceClient::getInstance()->voiceEnabled()
&& mCallBackEnabled;
// hide/show start call and end call buttons
@@ -320,8 +320,8 @@ void LLFloaterIMPanel::draw()
if (!voice_channel)
return;
- childSetVisible("end_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
- childSetVisible("start_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
+ childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
+ childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
childSetEnabled("start_call_btn", enable_connect);
childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
@@ -384,11 +384,11 @@ void LLFloaterIMPanel::draw()
else
{
// refresh volume and mute checkbox
- childSetVisible("speaker_volume", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
- childSetValue("speaker_volume", gVoiceClient->getUserVolume(mOtherParticipantUUID));
+ childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
+ childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
- childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
+ childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
}
LLFloater::draw();
}
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 15dbc03f70..c143ac9dea 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -342,13 +342,13 @@ LLIMModel::LLIMSession::~LLIMSession()
mSpeakers = NULL;
// End the text IM session if necessary
- if(gVoiceClient && mOtherParticipantID.notNull())
+ if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
{
switch(mType)
{
case IM_NOTHING_SPECIAL:
case IM_SESSION_P2P_INVITE:
- gVoiceClient->endUserIMSession(mOtherParticipantID);
+ LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
break;
default:
@@ -923,7 +923,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
{
// User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice.
- sent = gVoiceClient->sendTextMessage(other_participant_id, utf8_text);
+ sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
}
if(!sent)
@@ -1720,7 +1720,7 @@ void LLOutgoingCallDialog::show(const LLSD& key)
// skipping "You will now be reconnected to nearby" in notification when call is ended by disabling voice,
// so no reconnection to nearby chat happens (EXT-4397)
- bool voice_works = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
+ bool voice_works = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
std::string reconnect_nearby = voice_works ? LLTrans::getString("reconnect_nearby") : std::string();
childSetTextArg("nearby", "[RECONNECT_NEARBY]", reconnect_nearby);
@@ -1847,8 +1847,8 @@ LLCallDialog(payload)
void LLIncomingCallDialog::onLifetimeExpired()
{
- // check whether a call is valid or not
- if (LLVoiceClient::getInstance()->findSession(mPayload["caller_id"].asUUID()))
+ std::string session_handle = mPayload["session_handle"].asString();
+ if (LLVoiceClient::getInstance()->isValidChannel(session_handle))
{
// restart notification's timer if call is still valid
mLifetimeTimer.start();
@@ -2083,10 +2083,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
{
if (type == IM_SESSION_P2P_INVITE)
{
- if(gVoiceClient)
+ if(LLVoiceClient::getInstance())
{
std::string s = mPayload["session_handle"].asString();
- gVoiceClient->declineInvite(s);
+ LLVoiceClient::getInstance()->declineInvite(s);
}
}
else
@@ -2174,11 +2174,8 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
{
if (type == IM_SESSION_P2P_INVITE)
{
- if(gVoiceClient)
- {
- std::string s = payload["session_handle"].asString();
- gVoiceClient->declineInvite(s);
- }
+ std::string s = payload["session_handle"].asString();
+ LLVoiceClient::getInstance()->declineInvite(s);
}
else
{
@@ -3090,7 +3087,7 @@ public:
return;
}
- if(!LLVoiceClient::voiceEnabled() || !LLVoiceClient::getInstance()->voiceWorking())
+ if(!LLVoiceClient::getInstance()->voiceEnabled() || !LLVoiceClient::getInstance()->isVoiceWorking())
{
// Don't display voice invites unless the user has voice enabled.
return;
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index e48bb77bda..d9fdc876db 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -541,8 +541,7 @@ void LLInspectAvatar::toggleSelectedVoice(bool enabled)
void LLInspectAvatar::updateVolumeSlider()
{
-
- bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
+ bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
// Do not display volume slider and mute button if it
// is ourself or we are not in a voice channel together
@@ -572,6 +571,7 @@ void LLInspectAvatar::updateVolumeSlider()
volume_slider->setEnabled( !is_muted );
F32 volume;
+
if (is_muted)
{
// it's clearer to display their volume as zero
@@ -580,7 +580,7 @@ void LLInspectAvatar::updateVolumeSlider()
else
{
// actual volume
- volume = gVoiceClient->getUserVolume(mAvatarID);
+ volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
}
volume_slider->setValue( (F64)volume );
}
@@ -609,7 +609,7 @@ void LLInspectAvatar::onClickMuteVolume()
void LLInspectAvatar::onVolumeChange(const LLSD& data)
{
F32 volume = (F32)data.asReal();
- gVoiceClient->setUserVolume(mAvatarID, volume);
+ LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
}
void LLInspectAvatar::nameUpdatedCallback(
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index 91cbbbf430..a2b5ffbac4 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -480,7 +480,7 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
// Objects cannot be created by a group, so use agent URL format
LLUUID creator_id = nodep->mPermissions->getCreator();
std::string creator_url =
- LLSLURL::buildCommand("agent", creator_id, "about");
+ LLSLURL("agent", creator_id, "about").getSLURLString();
args["[CREATOR]"] = creator_url;
// created by one user but owned by another
@@ -490,12 +490,12 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
if (group_owned)
{
owner_id = nodep->mPermissions->getGroup();
- owner_url = LLSLURL::buildCommand("group", owner_id, "about");
+ owner_url = LLSLURL("group", owner_id, "about").getSLURLString();
}
else
{
owner_id = nodep->mPermissions->getOwner();
- owner_url = LLSLURL::buildCommand("agent", owner_id, "about");
+ owner_url = LLSLURL("agent", owner_id, "about").getSLURLString();
}
args["[OWNER]"] = owner_url;
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
index 66e4a1bf66..97ff771658 100644
--- a/indra/newview/llinspectremoteobject.cpp
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -176,11 +176,11 @@ void LLInspectRemoteObject::update()
{
if (mGroupOwned)
{
- owner = LLSLURL::buildCommand("group", mOwnerID, "about");
+ owner = LLSLURL("group", mOwnerID, "about").getSLURLString();
}
else
{
- owner = LLSLURL::buildCommand("agent", mOwnerID, "about");
+ owner = LLSLURL("agent", mOwnerID, "about").getSLURLString();
}
}
else
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2d08c0a01a..973257b19c 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -108,45 +108,6 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response);
void teleport_via_landmark(const LLUUID& asset_id);
-std::string ICON_NAME[ICON_NAME_COUNT] =
-{
- "Inv_Texture",
- "Inv_Sound",
- "Inv_CallingCard",
- "Inv_CallingCard",
- "Inv_Landmark",
- "Inv_Landmark",
- "Inv_Script",
- "Inv_Clothing",
- "Inv_Object",
- "Inv_Object_Multi",
- "Inv_Notecard",
- "Inv_Skin",
- "Inv_Snapshot",
-
- "Inv_BodyShape",
- "Inv_Skin",
- "Inv_Hair",
- "Inv_Eye",
- "Inv_Shirt",
- "Inv_Pants",
- "Inv_Shoe",
- "Inv_Socks",
- "Inv_Jacket",
- "Inv_Gloves",
- "Inv_Undershirt",
- "Inv_Underpants",
- "Inv_Skirt",
- "Inv_Alpha",
- "Inv_Tattoo",
-
- "Inv_Animation",
- "Inv_Gesture",
-
- "Inv_LinkItem",
- "Inv_LinkFolder"
-};
-
// +=================================================+
// | LLInvFVBridge |
// +=================================================+
@@ -156,14 +117,17 @@ LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
const LLUUID& uuid) :
mUUID(uuid),
mRoot(root),
- mInvType(LLInventoryType::IT_NONE)
+ mInvType(LLInventoryType::IT_NONE),
+ mIsLink(FALSE)
{
mInventoryPanel = inventory->getHandle();
+ const LLInventoryObject* obj = getInventoryObject();
+ mIsLink = obj && obj->getIsLinkType();
}
const std::string& LLInvFVBridge::getName() const
{
- LLInventoryObject* obj = getInventoryObject();
+ const LLInventoryObject* obj = getInventoryObject();
if(obj)
{
return obj->getName();
@@ -239,6 +203,11 @@ BOOL LLInvFVBridge::isItemMovable() const
return TRUE;
}
+BOOL LLInvFVBridge::isLink() const
+{
+ return mIsLink;
+}
+
/*virtual*/
/**
* @brief Adds this item into clipboard storage
@@ -645,10 +614,13 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Paste"));
}
- items.push_back(std::string("Paste As Link"));
- if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
+ if (gSavedSettings.getBOOL("InventoryLinking"))
{
- disabled_items.push_back(std::string("Paste As Link"));
+ items.push_back(std::string("Paste As Link"));
+ if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
}
items.push_back(std::string("Paste Separator"));
@@ -930,7 +902,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
{
llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
- new_listener = new LLScriptBridge(inventory, root, uuid);
+ new_listener = new LLItemBridge(inventory, root, uuid);
break;
case LLAssetType::AT_OBJECT:
@@ -979,7 +951,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
{
llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
- new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (EWearableType)flags);
+ new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (LLWearableType::EType)flags);
break;
case LLAssetType::AT_CATEGORY:
if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
@@ -1025,46 +997,36 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
}
}
-bool LLInvFVBridge::isInOutfitsSidePanel() const
+BOOL LLInvFVBridge::isInOutfitsSidePanel() const
{
LLInventoryPanel *my_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
LLPanelOutfitsInventory *outfit_panel =
dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
if (!outfit_panel)
- return false;
+ return FALSE;
return outfit_panel->isTabPanel(my_panel);
}
-bool LLInvFVBridge::canShare()
+BOOL LLInvFVBridge::canShare() const
{
const LLInventoryModel* model = getInventoryModel();
- if(!model)
- {
- return false;
- }
+ if (!model) return FALSE;
- LLViewerInventoryItem *item = model->getItem(mUUID);
+ const LLViewerInventoryItem *item = model->getItem(mUUID);
if (item)
{
- bool allowed = false;
- allowed = LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item);
- if (allowed &&
- !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
- {
- allowed = false;
- }
- if (allowed &&
- !item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- allowed = false;
- }
- return allowed;
+ if (!LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item))
+ return FALSE;
+ if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ return FALSE;
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
+ return FALSE;
+ return TRUE;
}
- LLViewerInventoryCategory* cat = model->getCategory(mUUID);
-
// All categories can be given.
- return cat != NULL;
+ const LLViewerInventoryCategory* cat = model->getCategory(mUUID);
+ return (cat != NULL);
}
// +=================================================+
@@ -1242,7 +1204,15 @@ void LLItemBridge::gotoItem()
LLUIImagePtr LLItemBridge::getIcon() const
{
- return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]);
+ LLInventoryObject *obj = getInventoryObject();
+ if (obj)
+ {
+ return LLInventoryIcon::getIcon(obj->getType(),
+ LLInventoryType::IT_NONE,
+ mIsLink);
+ }
+
+ return LLInventoryIcon::getIcon(LLInventoryIcon::ICONNAME_OBJECT);
}
PermissionMask LLItemBridge::getPermissionMask() const
@@ -1405,13 +1375,65 @@ BOOL LLItemBridge::removeItem()
{
return FALSE;
}
+
+
// move it to the trash
LLPreview::hide(mUUID, TRUE);
LLInventoryModel* model = getInventoryModel();
if(!model) return FALSE;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLViewerInventoryItem* item = getItem();
+ if (!item) return FALSE;
+
+ // Already in trash
+ if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE;
+
+ LLNotification::Params params("ConfirmItemDeleteHasLinks");
+ params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2));
+
+ // Check if this item has any links. If generic inventory linking is enabled,
+ // we can't do this check because we may have items in a folder somewhere that is
+ // not yet in memory, so we don't want false negatives. (If disabled, then we
+ // know we only have links in the Outfits folder which we explicitly fetch.)
+ if (!gSavedSettings.getBOOL("InventoryLinking"))
+ {
+ if (!item->getIsLinkType())
+ {
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ LLLinkedItemIDMatches is_linked_item_match(mUUID);
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::INCLUDE_TRASH,
+ is_linked_item_match);
+
+ const U32 num_links = cat_array.size() + item_array.size();
+ if (num_links > 0)
+ {
+ // Warn if the user is will break any links when deleting this item.
+ LLNotifications::instance().add(params);
+ return FALSE;
+ }
+ }
+ }
+
+ LLNotifications::instance().forceResponse(params, 0);
+ return TRUE;
+}
+
+BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return FALSE;
+
+ LLInventoryModel* model = getInventoryModel();
+ if (!model) return FALSE;
+
LLViewerInventoryItem* item = getItem();
+ if (!item) return FALSE;
+ const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
// if item is not already in trash
if(item && !model->isObjectDescendentOf(mUUID, trash_id))
{
@@ -1420,11 +1442,7 @@ BOOL LLItemBridge::removeItem()
// delete was successful
return TRUE;
}
- else
- {
- // tried to delete already item in trash (should purge?)
- return FALSE;
- }
+ return FALSE;
}
BOOL LLItemBridge::isItemCopyable() const
@@ -1589,8 +1607,12 @@ BOOL LLFolderBridge::isUpToDate() const
BOOL LLFolderBridge::isItemCopyable() const
{
- // Can copy folders to paste-as-link, but not for straight paste.
- return TRUE;
+ if (gSavedSettings.getBOOL("InventoryLinking"))
+ {
+ // Can copy folders to paste-as-link, but not for straight paste.
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLFolderBridge::copyToClipboard() const
@@ -2315,23 +2337,39 @@ LLUIImagePtr LLFolderBridge::getIcon() const
return getIcon(preferred_type);
}
-LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
+// static
+LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type, BOOL is_link)
{
- // we only have one folder image now
- if (preferred_type == LLFolderType::FT_OUTFIT)
+ // Bypassing LLViewerFolderType::lookup() since
+ // we aren't using different system folder icons
+ if (is_link)
{
- return LLUI::getUIImage("Inv_LookFolderClosed");
+ if (preferred_type == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderClosed_Link");
+ else
+ return LLUI::getUIImage("Inv_FolderClosed_Link");
}
- return LLUI::getUIImage("Inv_FolderClosed");
+ if (preferred_type == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderClosed");
+ else
+ return LLUI::getUIImage("Inv_FolderClosed");
}
LLUIImagePtr LLFolderBridge::getOpenIcon() const
{
- if (getPreferredType() == LLFolderType::FT_OUTFIT)
+ // Bypassing LLViewerFolderType::lookup() since
+ // we aren't using different system folder icons
+ if (isLink())
{
- return LLUI::getUIImage("Inv_LookFolderOpen");
+ if (getPreferredType() == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderOpen_Link");
+ else
+ return LLUI::getUIImage("Inv_FolderOpen_Link");
}
- return LLUI::getUIImage("Inv_FolderOpen");
+ if (getPreferredType() == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderOpen");
+ else
+ return LLUI::getUIImage("Inv_FolderOpen");
}
BOOL LLFolderBridge::renameItem(const std::string& new_name)
@@ -2895,71 +2933,71 @@ void LLFolderBridge::createNewCategory(void* user_data)
void LLFolderBridge::createNewShirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHIRT);
}
void LLFolderBridge::createNewPants(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PANTS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PANTS);
}
void LLFolderBridge::createNewShoes(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHOES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHOES);
}
void LLFolderBridge::createNewSocks(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SOCKS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SOCKS);
}
void LLFolderBridge::createNewJacket(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_JACKET);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_JACKET);
}
void LLFolderBridge::createNewSkirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIRT);
}
void LLFolderBridge::createNewGloves(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_GLOVES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_GLOVES);
}
void LLFolderBridge::createNewUndershirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERSHIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERSHIRT);
}
void LLFolderBridge::createNewUnderpants(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERPANTS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERPANTS);
}
void LLFolderBridge::createNewShape(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHAPE);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHAPE);
}
void LLFolderBridge::createNewSkin(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIN);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIN);
}
void LLFolderBridge::createNewHair(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_HAIR);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_HAIR);
}
void LLFolderBridge::createNewEyes(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_EYES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_EYES);
}
// static
-void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type)
+void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::EType type)
{
if(!bridge) return;
LLUUID parent_id = bridge->getUUID();
@@ -2969,7 +3007,7 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type)
// Separate function so can be called by global menu as well as right-click
// menu.
// static
-void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type)
+void LLFolderBridge::createWearable(const LLUUID &parent_id, LLWearableType::EType type)
{
LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
LLAssetType::EType asset_type = wearable->getAssetType();
@@ -3268,21 +3306,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
}
// +=================================================+
-// | LLScriptBridge (DEPRECTED) |
-// +=================================================+
-
-LLUIImagePtr LLScriptBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
-}
-
-// +=================================================+
// | LLTextureBridge |
// +=================================================+
LLUIImagePtr LLTextureBridge::getIcon() const
{
- return get_item_icon(LLAssetType::AT_TEXTURE, mInvType, 0, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_TEXTURE, mInvType, mIsLink);
}
void LLTextureBridge::openItem()
@@ -3362,32 +3391,14 @@ void LLTextureBridge::performAction(LLInventoryModel* model, std::string action)
// | LLSoundBridge |
// +=================================================+
-LLUIImagePtr LLSoundBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE);
-}
-
void LLSoundBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
-
+ const LLViewerInventoryItem* item = getItem();
if (item)
{
LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
}
-/*
-// Changed this back to the way it USED to work:
-// only open the preview dialog through the contextual right-click menu
-// double-click just plays the sound
-
-LLViewerInventoryItem* item = getItem();
-if(item)
-{
-openSoundPreview((void*)this);
-//send_uuid_sound_trigger(item->getAssetUUID(), 1.0);
}
-*/
- }
void LLSoundBridge::previewItem()
{
@@ -3452,7 +3463,7 @@ LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory,
LLUIImagePtr LLLandmarkBridge::getIcon() const
{
- return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mIsLink, mVisited, FALSE);
}
void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
@@ -3644,7 +3655,7 @@ LLUIImagePtr LLCallingCardBridge::getIcon() const
{
online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID());
}
- return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, mIsLink, online, FALSE);
}
std::string LLCallingCardBridge::getLabelSuffix() const
@@ -3802,39 +3813,19 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
// | LLNotecardBridge |
// +=================================================+
-LLUIImagePtr LLNotecardBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE);
-}
-
void LLNotecardBridge::openItem()
{
LLViewerInventoryItem* item = getItem();
-
if (item)
{
LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
}
-
-/*
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
- }
-*/
}
-
// +=================================================+
// | LLGestureBridge |
// +=================================================+
-LLUIImagePtr LLGestureBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE);
-}
-
LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
{
if( LLGestureMgr::instance().isGestureActive(mUUID) )
@@ -4010,11 +4001,6 @@ void LLGestureBridge::playGesture(const LLUUID& item_id)
// | LLAnimationBridge |
// +=================================================+
-LLUIImagePtr LLAnimationBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE);
-}
-
void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
menuentry_vec_t items;
@@ -4099,17 +4085,16 @@ LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory,
const LLUUID& uuid,
LLInventoryType::EType type,
U32 flags) :
- LLItemBridge(inventory, root, uuid),
- mInvType(type)
+ LLItemBridge(inventory, root, uuid)
{
mAttachPt = (flags & 0xff); // low bye of inventory flags
-
mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE;
+ mInvType = type;
}
LLUIImagePtr LLObjectBridge::getIcon() const
{
- return get_item_icon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject );
+ return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mIsLink, mAttachPt, mIsMultiObject);
}
LLInventoryObject* LLObjectBridge::getObject() const
@@ -4429,11 +4414,6 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
// | LLLSLTextBridge |
// +=================================================+
-LLUIImagePtr LLLSLTextBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
-}
-
void LLLSLTextBridge::openItem()
{
LLViewerInventoryItem* item = getItem();
@@ -4453,12 +4433,12 @@ LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
const LLUUID& uuid,
LLAssetType::EType asset_type,
LLInventoryType::EType inv_type,
- EWearableType wearable_type) :
+ LLWearableType::EType wearable_type) :
LLItemBridge(inventory, root, uuid),
mAssetType( asset_type ),
- mInvType(inv_type),
mWearableType(wearable_type)
{
+ mInvType = inv_type;
}
// *NOTE: hack to get from avatar inventory to avatar
@@ -4562,7 +4542,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_
if (item->getType() == LLAssetType::AT_BODYPART)
continue;
if (gAgent.isTeen() && item->isWearableType() &&
- (item->getWearableType() == WT_UNDERPANTS || item->getWearableType() == WT_UNDERSHIRT))
+ (item->getWearableType() == LLWearableType::WT_UNDERPANTS || item->getWearableType() == LLWearableType::WT_UNDERSHIRT))
continue;
if (get_is_item_worn(item->getUUID()))
{
@@ -4640,7 +4620,7 @@ std::string LLWearableBridge::getLabelSuffix() const
LLUIImagePtr LLWearableBridge::getIcon() const
{
- return get_item_icon(mAssetType, mInvType, mWearableType, FALSE);
+ return LLInventoryIcon::getIcon(mAssetType, mInvType, mIsLink, mWearableType, FALSE);
}
// virtual
@@ -4984,10 +4964,10 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
{
if( get_is_item_worn( item_id ) )
{
- EWearableType type = wearable->getType();
+ LLWearableType::EType type = wearable->getType();
- if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&&
- //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
+ if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&&
+ //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) )
{
bool do_remove_all = false;
U32 index = gAgentWearables.getWearableIndex(wearable);
@@ -5007,14 +4987,14 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
void LLWearableBridge::removeAllClothesFromAvatar()
{
// Remove COF links.
- for (S32 itype = WT_SHAPE; itype < WT_COUNT; ++itype)
+ for (S32 itype = LLWearableType::WT_SHAPE; itype < LLWearableType::WT_COUNT; ++itype)
{
- if (itype == WT_SHAPE || itype == WT_SKIN || itype == WT_HAIR || itype == WT_EYES)
+ if (itype == LLWearableType::WT_SHAPE || itype == LLWearableType::WT_SKIN || itype == LLWearableType::WT_HAIR || itype == LLWearableType::WT_EYES)
continue;
// MULTI-WEARABLES: fixed to index 0
LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(
- gAgentWearables.getWearableInventoryItem((EWearableType)itype, 0));
+ gAgentWearables.getWearableInventoryItem((LLWearableType::EType)itype, 0));
if (!item)
continue;
const LLUUID &item_id = gInventory.getLinkedItemID(item->getUUID());
@@ -5057,18 +5037,9 @@ void LLWearableBridge::removeFromAvatar()
// | LLLinkItemBridge |
// +=================================================+
// For broken item links
+
std::string LLLinkItemBridge::sPrefix("Link: ");
-LLUIImagePtr LLLinkItemBridge::getIcon() const
-{
- if (LLViewerInventoryItem *item = getItem())
- {
- U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags
- bool is_multi = LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags();
- return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi);
- }
- return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE);
-}
void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
// *TODO: Translate
@@ -5098,16 +5069,24 @@ void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
std::string LLLinkFolderBridge::sPrefix("Link: ");
LLUIImagePtr LLLinkFolderBridge::getIcon() const
{
- LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
- if (LLViewerInventoryItem *item = getItem())
+ LLFolderType::EType folder_type = LLFolderType::FT_NONE;
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj)
{
- if (const LLViewerInventoryCategory* cat = item->getLinkedCategory())
+ LLViewerInventoryCategory* cat = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
{
- preferred_type = cat->getPreferredType();
+ cat = (LLViewerInventoryCategory*)model->getCategory(obj->getLinkedUUID());
+ if (cat)
+ {
+ folder_type = cat->getPreferredType();
+ }
}
}
- return LLFolderBridge::getIcon(preferred_type);
+ return LLFolderBridge::getIcon(folder_type, TRUE);
}
+
void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
// *TODO: Translate
@@ -5525,3 +5504,67 @@ LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_
/** Bridge Actions
**
********************************************************************************/
+
+/************************************************************************/
+/* Recent Inventory Panel related classes */
+/************************************************************************/
+void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ LLFolderBridge::buildContextMenu(menu, flags);
+
+ menuentry_vec_t disabled_items, items = getMenuItems();
+
+ items.erase(std::find(items.begin(), items.end(), std::string("New Folder")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Script")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Note")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Gesture")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Clothes")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Body Parts")));
+
+ hide_context_entries(menu, items, disabled_items);
+}
+
+LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge(
+ LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags /*= 0x00*/ ) const
+{
+ LLInvFVBridge* new_listener = NULL;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_CATEGORY:
+ if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
+ {
+ // *TODO: Create a link folder handler instead if it is necessary
+ new_listener = LLInventoryFVBridgeBuilder::createBridge(
+ asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ root,
+ uuid,
+ flags);
+ break;
+ }
+ new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid);
+ break;
+ default:
+ new_listener = LLInventoryFVBridgeBuilder::createBridge(
+ asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ root,
+ uuid,
+ flags);
+ }
+ return new_listener;
+
+}
+
+
+// EOF
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index de63bdd76b..c5efefac7e 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -74,21 +74,26 @@ public:
U32 flags = 0x00);
virtual ~LLInvFVBridge() {}
- virtual const LLUUID& getUUID() const { return mUUID; }
+ BOOL isInOutfitsSidePanel() const; // allow context menus to be customized for side panel
+ BOOL canShare() const;
+ //--------------------------------------------------------------------
+ // LLInvFVBridge functionality
+ //--------------------------------------------------------------------
+ virtual const LLUUID& getUUID() const { return mUUID; }
+ virtual void clearDisplayName() {}
virtual void restoreItem() {}
virtual void restoreToWorld() {}
- // LLFolderViewEventListener functions
+ //--------------------------------------------------------------------
+ // Inherited LLFolderViewEventListener functions
+ //--------------------------------------------------------------------
virtual const std::string& getName() const;
virtual const std::string& getDisplayName() const;
virtual PermissionMask getPermissionMask() const;
virtual LLFolderType::EType getPreferredType() const;
virtual time_t getCreationDate() const;
- virtual LLFontGL::StyleFlags getLabelStyle() const
- {
- return LLFontGL::NORMAL;
- }
+ virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
virtual void openItem() {}
virtual void closeItem() {}
@@ -99,7 +104,7 @@ public:
virtual BOOL isItemRemovable() const;
virtual BOOL isItemMovable() const;
virtual BOOL isItemInTrash() const;
-
+ virtual BOOL isLink() const;
//virtual BOOL removeItem() = 0;
virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
@@ -119,14 +124,6 @@ public:
void* cargo_data) { return FALSE; }
virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
- // LLInvFVBridge functionality
- virtual void clearDisplayName() {}
-
- // Allow context menus to be customized for side panel.
- bool isInOutfitsSidePanel() const;
-
- bool canShare();
-
//--------------------------------------------------------------------
// Convenience functions for adding various common menu options.
//--------------------------------------------------------------------
@@ -146,7 +143,7 @@ protected:
BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory?
BOOL isAgentInventory() const; // false if lost or in the inventory library
- BOOL isCOFFolder() const; // true if COF or descendent of.
+ BOOL isCOFFolder() const; // true if COF or descendent of
virtual BOOL isItemPermissive() const;
static void changeItemParent(LLInventoryModel* model,
LLViewerInventoryItem* item,
@@ -162,11 +159,12 @@ protected:
LLFolderView* mRoot;
const LLUUID mUUID; // item id
LLInventoryType::EType mInvType;
+ BOOL mIsLink;
void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInvFVBridge
+// Class LLInvFVBridgeBuilder
//
// This class intended to build Folder View Bridge via LLInvFVBridge::createBridge.
// It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge.
@@ -184,49 +182,6 @@ public:
U32 flags = 0x00) const;
};
-// Used by LLItemBridge::getIcon
-enum EInventoryIcon
-{
- TEXTURE_ICON_NAME,
- SOUND_ICON_NAME,
- CALLINGCARD_ONLINE_ICON_NAME,
- CALLINGCARD_OFFLINE_ICON_NAME,
- LANDMARK_ICON_NAME,
- LANDMARK_VISITED_ICON_NAME,
- SCRIPT_ICON_NAME,
- CLOTHING_ICON_NAME,
- OBJECT_ICON_NAME,
- OBJECT_MULTI_ICON_NAME,
- NOTECARD_ICON_NAME,
- BODYPART_ICON_NAME,
- SNAPSHOT_ICON_NAME,
-
- BODYPART_SHAPE_ICON_NAME,
- BODYPART_SKIN_ICON_NAME,
- BODYPART_HAIR_ICON_NAME,
- BODYPART_EYES_ICON_NAME,
- CLOTHING_SHIRT_ICON_NAME,
- CLOTHING_PANTS_ICON_NAME,
- CLOTHING_SHOES_ICON_NAME,
- CLOTHING_SOCKS_ICON_NAME,
- CLOTHING_JACKET_ICON_NAME,
- CLOTHING_GLOVES_ICON_NAME,
- CLOTHING_UNDERSHIRT_ICON_NAME,
- CLOTHING_UNDERPANTS_ICON_NAME,
- CLOTHING_SKIRT_ICON_NAME,
- CLOTHING_ALPHA_ICON_NAME,
- CLOTHING_TATTOO_ICON_NAME,
-
- ANIMATION_ICON_NAME,
- GESTURE_ICON_NAME,
-
- LINKITEM_ICON_NAME,
- LINKFOLDER_ICON_NAME,
-
- ICON_NAME_COUNT
-};
-extern std::string ICON_NAME[ICON_NAME_COUNT];
-
class LLItemBridge : public LLInvFVBridge
{
public:
@@ -236,7 +191,6 @@ public:
LLInvFVBridge(inventory, root, uuid) {}
virtual void performAction(LLInventoryModel* model, std::string action);
-
virtual void selectItem();
virtual void restoreItem();
virtual void restoreToWorld();
@@ -255,28 +209,32 @@ public:
virtual BOOL hasChildren() const { return FALSE; }
virtual BOOL isUpToDate() const { return TRUE; }
- // override for LLInvFVBridge
- virtual void clearDisplayName() { mDisplayName.clear(); }
+ /*virtual*/ void clearDisplayName() { mDisplayName.clear(); }
LLViewerInventoryItem* getItem() const;
-
bool isAddAction(std::string action) const;
bool isRemoveAction(std::string action) const;
-
protected:
+ BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);
virtual BOOL isItemPermissive() const;
static void buildDisplayName(LLInventoryItem* item, std::string& name);
+
mutable std::string mDisplayName;
};
class LLFolderBridge : public LLInvFVBridge
{
- friend class LLInvFVBridge;
public:
- BOOL dragItemIntoFolder(LLInventoryItem* inv_item,
- BOOL drop);
- BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category,
- BOOL drop);
+ LLFolderBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLInvFVBridge(inventory, root, uuid),
+ mCallingCards(FALSE),
+ mWearables(FALSE),
+ mMenu(NULL) {}
+ BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop);
+ BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop);
+
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void openItem();
virtual void closeItem();
@@ -287,7 +245,7 @@ public:
virtual LLFolderType::EType getPreferredType() const;
virtual LLUIImagePtr getIcon() const;
virtual LLUIImagePtr getOpenIcon() const;
- static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
+ static LLUIImagePtr getIcon(LLFolderType::EType preferred_type, BOOL is_link = FALSE);
virtual BOOL renameItem(const std::string& new_name);
@@ -311,24 +269,17 @@ public:
virtual BOOL isClipboardPasteableAsLink() const;
virtual BOOL copyToClipboard() const;
- static void createWearable(LLFolderBridge* bridge, EWearableType type);
- static void createWearable(const LLUUID &parent_folder_id, EWearableType type);
+ static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
+ static void createWearable(const LLUUID &parent_folder_id, LLWearableType::EType type);
LLViewerInventoryCategory* getCategory() const;
protected:
- LLFolderBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLInvFVBridge(inventory, root, uuid),
- mCallingCards(FALSE),
- mWearables(FALSE),
- mMenu(NULL) {}
-
- // menu callbacks
+ //--------------------------------------------------------------------
+ // Menu callbacks
+ //--------------------------------------------------------------------
static void pasteClipboard(void* user_data);
static void createNewCategory(void* user_data);
-
static void createNewShirt(void* user_data);
static void createNewPants(void* user_data);
static void createNewShoes(void* user_data);
@@ -349,10 +300,17 @@ protected:
void modifyOutfit(BOOL append);
void determineFolderType();
+ menuentry_vec_t getMenuItems() { return mItems; } // returns a copy of current menu items
+
+
+ //--------------------------------------------------------------------
+ // Messy hacks for handling folder options
+ //--------------------------------------------------------------------
public:
static LLFolderBridge* sSelf;
static void staticFolderOptionsMenu();
void folderOptionsMenu();
+
private:
BOOL mCallingCards;
BOOL mWearables;
@@ -361,80 +319,59 @@ private:
menuentry_vec_t mDisabledItems;
};
-// DEPRECATED
-class LLScriptBridge : public LLItemBridge
-{
- friend class LLInvFVBridge;
-public:
- LLUIImagePtr getIcon() const;
-
-protected:
- LLScriptBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid ) :
- LLItemBridge(inventory, root, uuid) {}
-};
-
class LLTextureBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
- virtual LLUIImagePtr getIcon() const;
- virtual void openItem();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual void performAction(LLInventoryModel* model, std::string action);
-
-protected:
LLTextureBridge(LLInventoryPanel* inventory,
LLFolderView* root,
const LLUUID& uuid,
LLInventoryType::EType type) :
- LLItemBridge(inventory, root, uuid),
- mInvType(type)
- {}
+ LLItemBridge(inventory, root, uuid)
+ {
+ mInvType = type;
+ }
+ virtual LLUIImagePtr getIcon() const;
+ virtual void openItem();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void performAction(LLInventoryModel* model, std::string action);
bool canSaveTexture(void);
- LLInventoryType::EType mInvType;
};
class LLSoundBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
- virtual LLUIImagePtr getIcon() const;
+ LLSoundBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
virtual void openItem();
virtual void previewItem();
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
static void openSoundPreview(void*);
-
-protected:
- LLSoundBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
};
class LLLandmarkBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
+ LLLandmarkBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00);
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual LLUIImagePtr getIcon() const;
virtual void openItem();
-
-protected:
- LLLandmarkBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags = 0x00);
protected:
BOOL mVisited;
};
class LLCallingCardBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
+ LLCallingCardBridge(LLInventoryPanel* inventory,
+ LLFolderView* folder,
+ const LLUUID& uuid );
+ ~LLCallingCardBridge();
virtual std::string getLabelSuffix() const;
//virtual const std::string& getDisplayName() const;
virtual LLUIImagePtr getIcon() const;
@@ -446,75 +383,57 @@ public:
void* cargo_data);
void refreshFolderViewItem();
protected:
- LLCallingCardBridge(LLInventoryPanel* inventory,
- LLFolderView* folder,
- const LLUUID& uuid );
- ~LLCallingCardBridge();
-protected:
LLCallingCardObserver* mObserver;
};
-
class LLNotecardBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
- virtual LLUIImagePtr getIcon() const;
- virtual void openItem();
-protected:
LLNotecardBridge(LLInventoryPanel* inventory,
LLFolderView* root,
const LLUUID& uuid) :
LLItemBridge(inventory, root, uuid) {}
+ virtual void openItem();
};
class LLGestureBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
- virtual LLUIImagePtr getIcon() const;
-
+ LLGestureBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
// Only suffix for gesture items, not task items, because only
// gestures in your inventory can be active.
virtual LLFontGL::StyleFlags getLabelStyle() const;
virtual std::string getLabelSuffix() const;
-
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void openItem();
virtual BOOL removeItem();
-
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-
static void playGesture(const LLUUID& item_id);
-
-protected:
- LLGestureBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid)
- : LLItemBridge(inventory, root, uuid) {}
};
class LLAnimationBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-
- virtual LLUIImagePtr getIcon() const;
- virtual void openItem();
-
-protected:
LLAnimationBridge(LLInventoryPanel* inventory,
LLFolderView* root,
const LLUUID& uuid) :
LLItemBridge(inventory, root, uuid) {}
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void openItem();
};
class LLObjectBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
+ LLObjectBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLInventoryType::EType type,
+ U32 flags);
virtual LLUIImagePtr getIcon() const;
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void openItem();
@@ -522,38 +441,32 @@ public:
virtual std::string getLabelSuffix() const;
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual BOOL renameItem(const std::string& new_name);
-
LLInventoryObject* getObject() const;
protected:
- LLObjectBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- LLInventoryType::EType type,
- U32 flags);
-protected:
- static LLUUID sContextMenuItemID; // Only valid while the context menu is open.
- LLInventoryType::EType mInvType;
+ static LLUUID sContextMenuItemID; // Only valid while the context menu is open.
U32 mAttachPt;
BOOL mIsMultiObject;
};
class LLLSLTextBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
- virtual LLUIImagePtr getIcon() const;
- virtual void openItem();
-protected:
LLLSLTextBridge(LLInventoryPanel* inventory,
LLFolderView* root,
const LLUUID& uuid ) :
LLItemBridge(inventory, root, uuid) {}
+ virtual void openItem();
};
class LLWearableBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
+ LLWearableBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLAssetType::EType asset_type,
+ LLInventoryType::EType inv_type,
+ LLWearableType::EType wearable_type);
virtual LLUIImagePtr getIcon() const;
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void openItem();
@@ -579,52 +492,38 @@ public:
static void removeItemFromAvatar(LLViewerInventoryItem *item);
static void removeAllClothesFromAvatar();
void removeFromAvatar();
-
-protected:
- LLWearableBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- LLAssetType::EType asset_type,
- LLInventoryType::EType inv_type,
- EWearableType wearable_type);
protected:
LLAssetType::EType mAssetType;
- LLInventoryType::EType mInvType;
- EWearableType mWearableType;
+ LLWearableType::EType mWearableType;
};
class LLLinkItemBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
- virtual const std::string& getPrefix() { return sPrefix; }
- virtual LLUIImagePtr getIcon() const;
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-protected:
LLLinkItemBridge(LLInventoryPanel* inventory,
LLFolderView* root,
const LLUUID& uuid) :
LLItemBridge(inventory, root, uuid) {}
+ virtual const std::string& getPrefix() { return sPrefix; }
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
protected:
static std::string sPrefix;
};
class LLLinkFolderBridge : public LLItemBridge
{
- friend class LLInvFVBridge;
public:
+ LLLinkFolderBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
virtual const std::string& getPrefix() { return sPrefix; }
virtual LLUIImagePtr getIcon() const;
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void gotoItem();
protected:
- LLLinkFolderBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
const LLUUID &getFolderID() const;
-protected:
static std::string sPrefix;
};
@@ -658,6 +557,41 @@ protected:
LLInventoryModel* mModel;
};
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Recent Inventory Panel related classes
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+// Overridden version of the Inventory-Folder-View-Bridge for Folders
+class LLRecentItemsFolderBridge : public LLFolderBridge
+{
+public:
+ // Creates context menu for Folders related to Recent Inventory Panel.
+ // Uses base logic and than removes from visible items "New..." menu items.
+ LLRecentItemsFolderBridge(LLInventoryType::EType type,
+ LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLFolderBridge(inventory, root, uuid)
+ {
+ mInvType = type;
+ }
+ /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
+};
+
+// Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel
+class LLRecentInventoryBridgeBuilder : public LLInventoryFVBridgeBuilder
+{
+public:
+ // Overrides FolderBridge for Recent Inventory Panel.
+ // It use base functionality for bridges other than FolderBridge.
+ virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00) const;
+};
void wear_inventory_item_on_avatar(LLInventoryItem* item);
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 8010d1f43d..2b4d9fb25c 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1,5 +1,5 @@
/**
- * @file llfloaterinventory.cpp
+ * @file llinventoryfunctions.cpp
* @brief Implementation of the inventory view and associated stuff.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
@@ -87,45 +87,108 @@
BOOL LLInventoryState::sWearNewClothing = FALSE;
LLUUID LLInventoryState::sWearNewClothingTransactionID;
+// Generates a string containing the path to the item specified by
+// item_id.
+void append_path(const LLUUID& id, std::string& path)
+{
+ std::string temp;
+ const LLInventoryObject* obj = gInventory.getObject(id);
+ LLUUID parent_id;
+ if(obj) parent_id = obj->getParentUUID();
+ std::string forward_slash("/");
+ while(obj)
+ {
+ obj = gInventory.getCategory(parent_id);
+ if(obj)
+ {
+ temp.assign(forward_slash + obj->getName() + temp);
+ parent_id = obj->getParentUUID();
+ }
+ }
+ path.append(temp);
+}
+
+void change_item_parent(LLInventoryModel* model,
+ LLViewerInventoryItem* item,
+ const LLUUID& new_parent_id,
+ BOOL restamp)
+{
+ if (item->getParentUUID() != new_parent_id)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(restamp);
+ model->updateItem(new_item);
+ model->notifyObservers();
+ }
+}
+
+
+BOOL get_is_item_worn(const LLUUID& id)
+{
+ const LLViewerInventoryItem* item = gInventory.getItem(id);
+ if (!item)
+ return FALSE;
+
+ switch(item->getType())
+ {
+ case LLAssetType::AT_OBJECT:
+ {
+ if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
+ return TRUE;
+ break;
+ }
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
+ return TRUE;
+ break;
+ case LLAssetType::AT_GESTURE:
+ if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
+ return TRUE;
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
///----------------------------------------------------------------------------
/// LLInventoryCollectFunctor implementations
///----------------------------------------------------------------------------
// static
-bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item)
+bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(const LLInventoryItem* item)
{
if (!item)
return false;
- bool allowed = false;
-
switch(item->getType())
{
case LLAssetType::AT_CALLINGCARD:
- // not allowed
+ return false;
break;
-
case LLAssetType::AT_OBJECT:
if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
- {
- allowed = true;
- }
+ return true;
break;
-
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
if(!gAgentWearables.isWearingItem(item->getUUID()))
- {
- allowed = true;
- }
+ return true;
break;
default:
- allowed = true;
+ return true;
break;
}
-
- return allowed;
+ return false;
}
bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
@@ -406,202 +469,3 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)
folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
}
}
-
-static void assign_clothing_bodypart_icon(EInventoryIcon &idx, U32 attachment_point)
-{
- const EWearableType wearable_type = EWearableType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & attachment_point);
- switch(wearable_type)
- {
- case WT_SHAPE:
- idx = BODYPART_SHAPE_ICON_NAME;
- break;
- case WT_SKIN:
- idx = BODYPART_SKIN_ICON_NAME;
- break;
- case WT_HAIR:
- idx = BODYPART_HAIR_ICON_NAME;
- break;
- case WT_EYES:
- idx = BODYPART_EYES_ICON_NAME;
- break;
- case WT_SHIRT:
- idx = CLOTHING_SHIRT_ICON_NAME;
- break;
- case WT_PANTS:
- idx = CLOTHING_PANTS_ICON_NAME;
- break;
- case WT_SHOES:
- idx = CLOTHING_SHOES_ICON_NAME;
- break;
- case WT_SOCKS:
- idx = CLOTHING_SOCKS_ICON_NAME;
- break;
- case WT_JACKET:
- idx = CLOTHING_JACKET_ICON_NAME;
- break;
- case WT_GLOVES:
- idx = CLOTHING_GLOVES_ICON_NAME;
- break;
- case WT_UNDERSHIRT:
- idx = CLOTHING_UNDERSHIRT_ICON_NAME;
- break;
- case WT_UNDERPANTS:
- idx = CLOTHING_UNDERPANTS_ICON_NAME;
- break;
- case WT_SKIRT:
- idx = CLOTHING_SKIRT_ICON_NAME;
- break;
- case WT_ALPHA:
- idx = CLOTHING_ALPHA_ICON_NAME;
- break;
- case WT_TATTOO:
- idx = CLOTHING_TATTOO_ICON_NAME;
- break;
- default:
- break;
- }
-}
-
-
-const std::string& get_item_icon_name(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type,
- U32 attachment_point,
- BOOL item_is_multi )
-{
- EInventoryIcon idx = OBJECT_ICON_NAME;
- if ( item_is_multi )
- {
- idx = OBJECT_MULTI_ICON_NAME;
- }
-
- switch(asset_type)
- {
- case LLAssetType::AT_TEXTURE:
- if(LLInventoryType::IT_SNAPSHOT == inventory_type)
- {
- idx = SNAPSHOT_ICON_NAME;
- }
- else
- {
- idx = TEXTURE_ICON_NAME;
- }
- break;
-
- case LLAssetType::AT_SOUND:
- idx = SOUND_ICON_NAME;
- break;
- case LLAssetType::AT_CALLINGCARD:
- if(attachment_point!= 0)
- {
- idx = CALLINGCARD_ONLINE_ICON_NAME;
- }
- else
- {
- idx = CALLINGCARD_OFFLINE_ICON_NAME;
- }
- break;
- case LLAssetType::AT_LANDMARK:
- if(attachment_point!= 0)
- {
- idx = LANDMARK_VISITED_ICON_NAME;
- }
- else
- {
- idx = LANDMARK_ICON_NAME;
- }
- break;
- case LLAssetType::AT_SCRIPT:
- case LLAssetType::AT_LSL_TEXT:
- case LLAssetType::AT_LSL_BYTECODE:
- idx = SCRIPT_ICON_NAME;
- break;
- case LLAssetType::AT_CLOTHING:
- idx = CLOTHING_ICON_NAME;
- assign_clothing_bodypart_icon(idx, attachment_point);
- break;
- case LLAssetType::AT_BODYPART:
- idx = BODYPART_ICON_NAME;
- assign_clothing_bodypart_icon(idx, attachment_point);
- break;
- case LLAssetType::AT_NOTECARD:
- idx = NOTECARD_ICON_NAME;
- break;
- case LLAssetType::AT_ANIMATION:
- idx = ANIMATION_ICON_NAME;
- break;
- case LLAssetType::AT_GESTURE:
- idx = GESTURE_ICON_NAME;
- break;
- case LLAssetType::AT_LINK:
- idx = LINKITEM_ICON_NAME;
- break;
- case LLAssetType::AT_LINK_FOLDER:
- idx = LINKFOLDER_ICON_NAME;
- break;
- default:
- break;
- }
-
- return ICON_NAME[idx];
-}
-
-LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type,
- U32 attachment_point,
- BOOL item_is_multi)
-{
- const std::string& icon_name = get_item_icon_name(asset_type, inventory_type, attachment_point, item_is_multi );
- return LLUI::getUIImage(icon_name);
-}
-
-BOOL get_is_item_worn(const LLUUID& id)
-{
- const LLViewerInventoryItem* item = gInventory.getItem(id);
- if (!item)
- return FALSE;
-
- switch(item->getType())
- {
- case LLAssetType::AT_OBJECT:
- {
- if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
- return TRUE;
- break;
- }
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
- return TRUE;
- break;
- case LLAssetType::AT_GESTURE:
- if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
- return TRUE;
- break;
- default:
- break;
- }
- return FALSE;
-}
-
-
-void change_item_parent(LLInventoryModel* model,
- LLViewerInventoryItem* item,
- const LLUUID& new_parent_id,
- BOOL restamp)
-{
- if (item->getParentUUID() != new_parent_id)
- {
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setParent(new_parent_id);
- new_item->updateParentOnServer(restamp);
- model->updateItem(new_item);
- model->notifyObservers();
- }
-}
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 6f373f7392..79b9b4a9cc 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -40,6 +40,27 @@
/********************************************************************************
** **
+ ** MISCELLANEOUS GLOBAL FUNCTIONS
+ **/
+
+// Is this item or its baseitem is worn, attached, etc...
+BOOL get_is_item_worn(const LLUUID& id);
+
+
+void change_item_parent(LLInventoryModel* model,
+ LLViewerInventoryItem* item,
+ const LLUUID& new_parent_id,
+ BOOL restamp);
+
+// Generates a string containing the path to the item specified by item_id.
+void append_path(const LLUUID& id, std::string& path);
+
+/** Miscellaneous global functions
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
** INVENTORY COLLECTOR FUNCTIONS
**/
@@ -58,7 +79,7 @@ public:
virtual ~LLInventoryCollectFunctor(){};
virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
- static bool itemTransferCommonlyAllowed(LLInventoryItem* item);
+ static bool itemTransferCommonlyAllowed(const LLInventoryItem* item);
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -297,25 +318,6 @@ public:
virtual void doItem(LLFolderViewItem* item);
};
-const std::string& get_item_icon_name(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type,
- U32 attachment_point,
- BOOL item_is_multi );
-
-LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type,
- U32 attachment_point,
- BOOL item_is_multi );
-
-// Is this item or its baseitem is worn, attached, etc...
-BOOL get_is_item_worn(const LLUUID& id);
-
-
-void change_item_parent(LLInventoryModel* model,
- LLViewerInventoryItem* item,
- const LLUUID& new_parent_id,
- BOOL restamp);
-
#endif // LL_LLINVENTORYFUNCTIONS_H
diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp
new file mode 100644
index 0000000000..2fb55f4c1f
--- /dev/null
+++ b/indra/newview/llinventoryicon.cpp
@@ -0,0 +1,187 @@
+/**
+ * @file llinventoryicon.cpp
+ * @brief Implementation of the inventory icon.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llinventoryicon.h"
+
+#include "lldictionary.h"
+#include "llinventorydefines.h"
+#include "llui.h"
+#include "llwearabletype.h"
+
+struct IconEntry : public LLDictionaryEntry
+{
+ IconEntry(const std::string &item_name,
+ const std::string &link_name)
+ :
+ LLDictionaryEntry(item_name),
+ mLinkName(link_name)
+ {}
+ const std::string mLinkName;
+};
+
+class LLIconDictionary : public LLSingleton<LLIconDictionary>,
+ public LLDictionary<LLInventoryIcon::EIconName, IconEntry>
+{
+public:
+ LLIconDictionary();
+};
+
+LLIconDictionary::LLIconDictionary()
+{
+ addEntry(LLInventoryIcon::ICONNAME_TEXTURE, new IconEntry("Inv_Texture", "Inv_Texture_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_SOUND, new IconEntry("Inv_Texture", "Inv_Texture_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_ONLINE, new IconEntry("Inv_CallingCard", "Inv_CallingCard_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_OFFLINE, new IconEntry("Inv_CallingCard", "Inv_CallingCard_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_LANDMARK, new IconEntry("Inv_Landmark", "Inv_Landmark_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_LANDMARK_VISITED, new IconEntry("Inv_Landmark", "Inv_Landmark_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_SCRIPT, new IconEntry("Inv_Script", "Inv_Script_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING, new IconEntry("Inv_Clothing", "Inv_Clothing_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_OBJECT, new IconEntry("Inv_Object", "Inv_Object_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_OBJECT_MULTI, new IconEntry("Inv_Object_Multi", "Inv_Object_Multi_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_NOTECARD, new IconEntry("Inv_Notecard", "Inv_Notecard_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_BODYPART, new IconEntry("Inv_Skin", "Inv_Skin_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_SNAPSHOT, new IconEntry("Inv_Snapshot", "Inv_Snapshot_Link"));
+
+ addEntry(LLInventoryIcon::ICONNAME_BODYPART_SHAPE, new IconEntry("Inv_BodyShape", "Inv_BodyShape_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_BODYPART_SKIN, new IconEntry("Inv_Skin", "Inv_Skin_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_BODYPART_HAIR, new IconEntry("Inv_Hair", "Inv_Hair_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_BODYPART_EYES, new IconEntry("Inv_Eye", "Inv_Eye_Link"));
+
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SHIRT, new IconEntry("Inv_Shirt", "Inv_Shirt_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_PANTS, new IconEntry("Inv_Pants", "Inv_Pants_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SHOES, new IconEntry("Inv_Shoe", "Inv_Shoe_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SOCKS, new IconEntry("Inv_Socks", "Inv_Socks_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_JACKET, new IconEntry("Inv_Jacket", "Inv_Jacket_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_GLOVES, new IconEntry("Inv_Gloves", "Inv_Gloves_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_UNDERSHIRT, new IconEntry("Inv_Undershirt", "Inv_Undershirt_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_UNDERPANTS, new IconEntry("Inv_Underpants", "Inv_Underpants_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SKIRT, new IconEntry("Inv_Skirt", "Inv_Skirt_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_ALPHA, new IconEntry("Inv_Alpha", "Inv_Alpha_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_CLOTHING_TATTOO, new IconEntry("Inv_Tattoo", "Inv_Tattoo_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_ANIMATION, new IconEntry("Inv_Animation", "Inv_Animation_Link"));
+ addEntry(LLInventoryIcon::ICONNAME_GESTURE, new IconEntry("Inv_Gesture", "Inv_Gesture_Link"));
+
+ addEntry(LLInventoryIcon::ICONNAME_LINKITEM, new IconEntry("Inv_LinkItem", "Inv_LinkItem"));
+ addEntry(LLInventoryIcon::ICONNAME_LINKFOLDER, new IconEntry("Inv_LinkItem", "Inv_LinkItem"));
+
+ addEntry(LLInventoryIcon::ICONNAME_NONE, new IconEntry("NONE", "NONE"));
+}
+
+LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type,
+ LLInventoryType::EType inventory_type,
+ BOOL item_is_link,
+ U32 misc_flag,
+ BOOL item_is_multi)
+{
+ const std::string& icon_name = getIconName(asset_type, inventory_type, item_is_link, misc_flag, item_is_multi);
+ return LLUI::getUIImage(icon_name);
+}
+
+LLUIImagePtr LLInventoryIcon::getIcon(EIconName idx)
+{
+ return LLUI::getUIImage(getIconName(idx));
+}
+
+const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type,
+ LLInventoryType::EType inventory_type,
+ BOOL item_is_link,
+ U32 misc_flag,
+ BOOL item_is_multi)
+{
+ EIconName idx = ICONNAME_OBJECT;
+ if (item_is_multi)
+ {
+ idx = ICONNAME_OBJECT_MULTI;
+ }
+
+ switch(asset_type)
+ {
+ case LLAssetType::AT_TEXTURE:
+ idx = (inventory_type == LLInventoryType::IT_SNAPSHOT) ? ICONNAME_SNAPSHOT : ICONNAME_TEXTURE;
+ break;
+ case LLAssetType::AT_SOUND:
+ idx = ICONNAME_SOUND;
+ break;
+ case LLAssetType::AT_CALLINGCARD:
+ idx = (misc_flag != 0) ? ICONNAME_CALLINGCARD_ONLINE : ICONNAME_CALLINGCARD_OFFLINE;
+ break;
+ case LLAssetType::AT_LANDMARK:
+ idx = (misc_flag != 0) ? ICONNAME_LANDMARK_VISITED : ICONNAME_LANDMARK;
+ break;
+ case LLAssetType::AT_SCRIPT:
+ case LLAssetType::AT_LSL_TEXT:
+ case LLAssetType::AT_LSL_BYTECODE:
+ idx = ICONNAME_SCRIPT;
+ break;
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ idx = assignWearableIcon(misc_flag);
+ break;
+ case LLAssetType::AT_NOTECARD:
+ idx = ICONNAME_NOTECARD;
+ break;
+ case LLAssetType::AT_ANIMATION:
+ idx = ICONNAME_ANIMATION;
+ break;
+ case LLAssetType::AT_GESTURE:
+ idx = ICONNAME_GESTURE;
+ break;
+ case LLAssetType::AT_LINK:
+ idx = ICONNAME_LINKITEM;
+ break;
+ case LLAssetType::AT_LINK_FOLDER:
+ idx = ICONNAME_LINKFOLDER;
+ break;
+ case LLAssetType::AT_OBJECT:
+ idx = ICONNAME_OBJECT;
+ break;
+ default:
+ break;
+ }
+
+ return getIconName(idx, item_is_link);
+}
+
+
+const std::string& LLInventoryIcon::getIconName(EIconName idx, BOOL item_is_link)
+{
+ const IconEntry *entry = LLIconDictionary::instance().lookup(idx);
+ if (item_is_link) return entry->mLinkName;
+ return entry->mName;
+}
+
+LLInventoryIcon::EIconName LLInventoryIcon::assignWearableIcon(U32 misc_flag)
+{
+ const LLWearableType::EType wearable_type = LLWearableType::EType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & misc_flag);
+ return LLWearableType::getIconName(wearable_type);
+}
diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h
new file mode 100644
index 0000000000..4cb7a123c4
--- /dev/null
+++ b/indra/newview/llinventoryicon.h
@@ -0,0 +1,108 @@
+/**
+ * @file llinventoryfunctions.h
+ * @brief Miscellaneous inventory-related functions and classes
+ * class definition
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLINVENTORYICON_H
+#define LL_LLINVENTORYICON_H
+
+#include "llassettype.h"
+#include "llinventorytype.h"
+#include "lluiimage.h"
+
+class LLInventoryIcon
+{
+public:
+ enum EIconName
+ {
+ ICONNAME_TEXTURE,
+ ICONNAME_SOUND,
+ ICONNAME_CALLINGCARD_ONLINE,
+ ICONNAME_CALLINGCARD_OFFLINE,
+ ICONNAME_LANDMARK,
+ ICONNAME_LANDMARK_VISITED,
+ ICONNAME_SCRIPT,
+ ICONNAME_CLOTHING,
+ ICONNAME_OBJECT,
+ ICONNAME_OBJECT_MULTI,
+ ICONNAME_NOTECARD,
+ ICONNAME_BODYPART,
+ ICONNAME_SNAPSHOT,
+
+ ICONNAME_BODYPART_SHAPE,
+ ICONNAME_BODYPART_SKIN,
+ ICONNAME_BODYPART_HAIR,
+ ICONNAME_BODYPART_EYES,
+ ICONNAME_CLOTHING_SHIRT,
+ ICONNAME_CLOTHING_PANTS,
+ ICONNAME_CLOTHING_SHOES,
+ ICONNAME_CLOTHING_SOCKS,
+ ICONNAME_CLOTHING_JACKET,
+ ICONNAME_CLOTHING_GLOVES,
+ ICONNAME_CLOTHING_UNDERSHIRT,
+ ICONNAME_CLOTHING_UNDERPANTS,
+ ICONNAME_CLOTHING_SKIRT,
+ ICONNAME_CLOTHING_ALPHA,
+ ICONNAME_CLOTHING_TATTOO,
+
+ ICONNAME_ANIMATION,
+ ICONNAME_GESTURE,
+
+ ICONNAME_LINKITEM,
+ ICONNAME_LINKFOLDER,
+
+ ICONNAME_COUNT,
+
+ ICONNAME_NONE = -1
+ };
+
+ static const std::string& getIconName(LLAssetType::EType asset_type,
+ LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
+ BOOL item_is_link = FALSE,
+ U32 misc_flag = 0, // different meanings depending on item type
+ BOOL item_is_multi = FALSE);
+ static const std::string& getIconName(EIconName idx,
+ BOOL item_is_link = FALSE);
+
+ static LLUIImagePtr getIcon(LLAssetType::EType asset_type,
+ LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
+ BOOL item_is_link = FALSE,
+ U32 misc_flag = 0, // different meanings depending on item type
+ BOOL item_is_multi = FALSE);
+ static LLUIImagePtr getIcon(EIconName idx);
+
+protected:
+ static EIconName assignWearableIcon(U32 misc_flag);
+};
+#endif // LL_LLINVENTORYICON_H
+
+
+
diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp
index 9719de4650..2d1d401cd4 100644
--- a/indra/newview/llinventoryitemslist.cpp
+++ b/indra/newview/llinventoryitemslist.cpp
@@ -40,11 +40,13 @@
// llcommon
#include "llcommonutils.h"
+// llui
#include "lliconctrl.h"
+#include "lluitextutil.h"
+#include "llcallbacklist.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
-#include "lltextutil.h"
#include "lltrans.h"
////////////////////////////////////////////////////////////////////////////////
@@ -130,7 +132,7 @@ BOOL LLPanelInventoryListItemBase::postBuild()
setIconCtrl(getChild<LLIconCtrl>("item_icon"));
setTitleCtrl(getChild<LLTextBox>("item_name"));
- mIconImage = get_item_icon(mItem->getType(), mItem->getInventoryType(), mItem->getFlags(), FALSE);
+ mIconImage = LLInventoryIcon::getIcon(mItem->getType(), mItem->getInventoryType(), mItem->getIsLinkType(), mItem->getFlags(), FALSE);
setNeedsRefresh(true);
@@ -320,6 +322,7 @@ LLInventoryItemsList::Params::Params()
LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p)
: LLFlatListViewEx(p)
, mNeedsRefresh(false)
+, mPrevVisibility(false)
{
// TODO: mCommitOnSelectionChange is set to "false" in LLFlatListView
// but reset to true in all derived classes. This settings might need to
@@ -327,6 +330,8 @@ LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p
setCommitOnSelectionChange(true);
setNoFilteredItemsMsg(LLTrans::getString("InventoryNoMatchingItems"));
+
+ gIdleCallbacks.addFunction(idle, this);
}
// virtual
@@ -344,12 +349,31 @@ void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item
mNeedsRefresh = true;
}
-void LLInventoryItemsList::draw()
+boost::signals2::connection LLInventoryItemsList::setRefreshCompleteCallback(const commit_signal_t::slot_type& cb)
{
- LLFlatListViewEx::draw();
- if(mNeedsRefresh)
+ return mRefreshCompleteSignal.connect(cb);
+}
+
+void LLInventoryItemsList::doIdle()
+{
+ bool cur_visibility = getVisible();
+ if(cur_visibility != mPrevVisibility || mNeedsRefresh)
{
refresh();
+
+ mRefreshCompleteSignal(this, LLSD());
+
+ mPrevVisibility = getVisible();
+ }
+}
+
+//static
+void LLInventoryItemsList::idle(void* user_data)
+{
+ LLInventoryItemsList* self = static_cast<LLInventoryItemsList*>(user_data);
+ if ( self )
+ { // Do the real idle
+ self->doIdle();
}
}
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h
index bc04eb6f5b..60cccc0f4f 100644
--- a/indra/newview/llinventoryitemslist.h
+++ b/indra/newview/llinventoryitemslist.h
@@ -42,6 +42,7 @@
// newview
#include "llflatlistview.h"
+#include "llviewerinventory.h"
class LLIconCtrl;
class LLTextBox;
@@ -120,6 +121,9 @@ public:
/* Removes item highlight */
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+ /** Get the name of a corresponding inventory item */
+ const std::string& getItemName() const { return mItem->getName(); }
+
virtual ~LLPanelInventoryListItemBase(){}
protected:
@@ -208,14 +212,23 @@ public:
void refreshList(const LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array);
+ boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
+
/**
- * Let list know items need to be refreshed in next draw()
+ * Let list know items need to be refreshed in next doIdle()
*/
void setNeedsRefresh(bool needs_refresh){ mNeedsRefresh = needs_refresh; }
bool getNeedsRefresh(){ return mNeedsRefresh; }
- /*virtual*/ void draw();
+ /**
+ * Idle routine used to refresh the list regardless of the current list
+ * visibility, unlike draw() which is called only for the visible list.
+ * This is needed for example to filter items of the list hidden by closed
+ * accordion tab.
+ */
+ void doIdle(); // Real idle routine
+ static void idle(void* user_data); // static glue to doIdle()
protected:
friend class LLUICtrlFactory;
@@ -225,7 +238,7 @@ protected:
/**
* Refreshes list items, adds new items and removes deleted items.
- * Called from draw() until all new items are added, ,
+ * Called from doIdle() until all new items are added,
* maximum 50 items can be added during single call.
*/
void refresh();
@@ -245,6 +258,10 @@ private:
uuid_vec_t mIDs; // IDs of items that were added in refreshList().
// Will be used in refresh() to determine added and removed ids
bool mNeedsRefresh;
+
+ bool mPrevVisibility;
+
+ commit_signal_t mRefreshCompleteSignal;
};
#endif //LL_LLINVENTORYITEMSLIST_H
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 6452ae82f8..a527694d25 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -319,30 +319,18 @@ void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id)
// specifies 'type' as what it defaults to containing. The category is
// not necessarily only for that type. *NOTE: This will create a new
// inventory category on the fly if one does not exist.
-const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType t, bool create_folder, bool find_in_library)
-{
- const LLUUID &rv = findCatUUID(t, find_in_library);
- if(rv.isNull() && isInventoryUsable() && (create_folder && !find_in_library))
- {
- const LLUUID &root_id = gInventory.getRootFolderID();
- if(root_id.notNull())
- {
- return createNewCategory(root_id, t, LLStringUtil::null);
- }
- }
- return rv;
-}
-
-// Internal method which looks for a category with the specified
-// preferred type. Returns LLUUID::null if not found.
-const LLUUID &LLInventoryModel::findCatUUID(LLFolderType::EType preferred_type, bool find_in_library) const
+const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type,
+ bool create_folder,
+ bool find_in_library)
{
+ LLUUID rv = LLUUID::null;
+
const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID();
if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)
{
- return root_id;
+ rv = root_id;
}
- if(root_id.notNull())
+ else if (root_id.notNull())
{
cat_array_t* cats = NULL;
cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
@@ -353,12 +341,21 @@ const LLUUID &LLInventoryModel::findCatUUID(LLFolderType::EType preferred_type,
{
if(cats->get(i)->getPreferredType() == preferred_type)
{
- return cats->get(i)->getUUID();
+ rv = cats->get(i)->getUUID();
+ break;
}
}
}
}
- return LLUUID::null;
+
+ if(rv.isNull() && isInventoryUsable() && (create_folder && !find_in_library))
+ {
+ if(root_id.notNull())
+ {
+ return createNewCategory(root_id, preferred_type, LLStringUtil::null);
+ }
+ }
+ return rv;
}
// Convenience function to create a new category. You could call
@@ -583,27 +580,6 @@ LLInventoryModel::item_array_t LLInventoryModel::collectLinkedItems(const LLUUID
return items;
}
-// Generates a string containing the path to the item specified by
-// item_id.
-void LLInventoryModel::appendPath(const LLUUID& id, std::string& path) const
-{
- std::string temp;
- const LLInventoryObject* obj = getObject(id);
- LLUUID parent_id;
- if(obj) parent_id = obj->getParentUUID();
- std::string forward_slash("/");
- while(obj)
- {
- obj = getCategory(parent_id);
- if(obj)
- {
- temp.assign(forward_slash + obj->getName() + temp);
- parent_id = obj->getParentUUID();
- }
- }
- path.append(temp);
-}
-
bool LLInventoryModel::isInventoryUsable() const
{
bool result = false;
@@ -1024,98 +1000,6 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
}
}
-void LLInventoryModel::deleteFromServer(LLDynamicArray<LLUUID>& category_ids,
- LLDynamicArray<LLUUID>& item_ids)
-{
- // Store off tre UUIDS of parents which are being deleted (thus no
- // need to increment) and the parents which are being modified. We
- // have to increment the version of the parent with each message
- // sent upstream since the dataserver will increment each unique
- // parent per update message.
- std::set<LLUUID> ignore_parents;
- update_map_t inc_parents;
-
- S32 i;
- S32 count = category_ids.count();
- BOOL start_new_message = TRUE;
- LLMessageSystem* msg = gMessageSystem;
- LLPointer<LLViewerInventoryCategory> cat;
- for(i = 0; i < count; i++)
- {
- if(start_new_message)
- {
- start_new_message = FALSE;
- msg->newMessageFast(_PREHASH_RemoveInventoryObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- }
- LLUUID cat_id = category_ids.get(i);
-
- msg->nextBlockFast(_PREHASH_FolderData);
- msg->addUUIDFast(_PREHASH_FolderID, cat_id);
- cat = getCategory(cat_id);
- ignore_parents.insert(cat_id);
- addChangedMask(LLInventoryObserver::REMOVE | LLInventoryObserver::STRUCTURE, cat_id);
- if(cat.notNull() && (ignore_parents.find(cat->getParentUUID())==ignore_parents.end()))
- {
- --inc_parents[cat->getParentUUID()];
- }
- if(msg->isSendFullFast(_PREHASH_FolderData))
- {
- start_new_message = TRUE;
- msg->nextBlockFast(_PREHASH_ItemData);
- msg->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
- gAgent.sendReliableMessage();
- accountForUpdate(inc_parents);
- inc_parents.clear();
- }
- }
-
- count = item_ids.count();
- std::set<LLUUID>::iterator not_ignored = ignore_parents.end();
- LLPointer<LLViewerInventoryItem> item;
- if((0 == count) && (!start_new_message))
- {
- msg->nextBlockFast(_PREHASH_ItemData);
- msg->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
- }
- for(i = 0; i < count; i++)
- {
- if(start_new_message)
- {
- start_new_message = FALSE;
- msg->newMessageFast(_PREHASH_RemoveInventoryObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_FolderData);
- msg->addUUIDFast(_PREHASH_FolderID, LLUUID::null);
- }
- LLUUID item_id = item_ids.get(i);
- msg->nextBlockFast(_PREHASH_ItemData);
- msg->addUUIDFast(_PREHASH_ItemID, item_id);
- item = getItem(item_id);
- addChangedMask(LLInventoryObserver::REMOVE | LLInventoryObserver::STRUCTURE, item_id);
- if(item.notNull() && (ignore_parents.find(item->getParentUUID()) == not_ignored))
- {
- --inc_parents[item->getParentUUID()];
- }
- if(msg->isSendFullFast(_PREHASH_ItemData))
- {
- start_new_message = TRUE;
- gAgent.sendReliableMessage();
- accountForUpdate(inc_parents);
- inc_parents.clear();
- }
- }
- if(!start_new_message)
- {
- gAgent.sendReliableMessage();
- accountForUpdate(inc_parents);
- }
-}
-
// Add/remove an observer. If the observer is destroyed, be sure to
// remove it.
void LLInventoryModel::addObserver(LLInventoryObserver* observer)
@@ -1206,29 +1090,7 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
}
}
-// This method to prepares a set of mock inventory which provides
-// minimal functionality before the actual arrival of inventory.
-/*
-void LLInventoryModel::mock(const LLUUID& root_id)
-{
- llinfos << "LLInventoryModel::mock() " << root_id << llendl;
- if(root_id.isNull())
- {
- llwarns << "Not a valid root id" << llendl;
- return;
- }
- LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(
- root_id,
- LLUUID::null,
- LLAssetType::AT_CATEGORY,
- LLFolderType::lookupNewCategoryName(LLFolderType::FT_ROOT_INVENTORY),
- gAgent.getID());
- addCategory(cat);
- gInventory.buildParentChildMap();
-}
-*/
-
-//If we get back a normal response, handle it here
+// If we get back a normal response, handle it here
void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content)
{
start_new_inventory_observer();
@@ -1301,7 +1163,7 @@ void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::str
gInventory.notifyObservers("fetchinventory");
}
-bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
+bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const
{
if(folder_id.isNull())
{
@@ -1329,7 +1191,6 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
return cat->fetch();
}
-
void LLInventoryModel::cache(
const LLUUID& parent_folder_id,
const LLUUID& agent_id)
@@ -1837,88 +1698,6 @@ bool LLInventoryModel::loadSkeleton(
return rv;
}
-bool LLInventoryModel::loadMeat(const LLSD& options, const LLUUID& owner_id)
-{
- llinfos << "importing inventory for " << owner_id << llendl;
- bool rv = true;
- for(LLSD::array_const_iterator it = options.beginArray(),
- end = options.endArray(); it != end; ++it)
- {
- LLSD name = (*it)["name"];
- LLSD item_id = (*it)["item_id"];
- LLSD parent_id = (*it)["parent_id"];
- LLSD asset_type = (*it)["type"];
- LLSD data_id = (*it)["data_id"];
- if(name.isDefined()
- && item_id.isDefined()
- && parent_id.isDefined()
- && asset_type.isDefined()
- && data_id.isDefined())
- {
- LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
- item->rename(name.asString());
- item->setUUID(item_id.asUUID());
- item->setParent(parent_id.asUUID());
- LLAssetType::EType type = (LLAssetType::EType)asset_type.asInteger();
- item->setType(type);
-
- LLSD llsd_inv_type = (*it)["inv_type"];
- if(llsd_inv_type.isDefined())
- {
- LLInventoryType::EType inv_type = (LLInventoryType::EType)llsd_inv_type.asInteger();
- item->setInventoryType(inv_type);
- }
-
- if(LLAssetType::AT_CALLINGCARD == type)
- {
- LLPermissions perm;
- perm.init(data_id.asUUID(), owner_id, LLUUID::null, LLUUID::null);
- item->setPermissions(perm);
- }
- else
- {
- LLPermissions default_perm;
- default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null);
- LLSD llsd_perm_mask = (*it)["perm_mask"];
- if(llsd_perm_mask.isDefined())
- {
- PermissionMask perm_mask = llsd_perm_mask.asInteger();
- default_perm.initMasks(
- perm_mask, perm_mask, perm_mask, perm_mask, perm_mask);
- }
- else
- {
- default_perm.initMasks(
- PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE);
- }
- item->setPermissions(default_perm);
- item->setAssetUUID(data_id.asUUID());
- }
-
- LLSD flags = (*it)["flags"];
- if(flags.isDefined())
- {
- // Not sure how well LLSD.asInteger() maps to
- // unsigned long - using strtoul()
- item->setFlags(strtoul(flags.asString().c_str(), NULL, 0));
- }
-
- LLSD time = (*it)["time"];
- if(time.isDefined())
- {
- item->setCreationDate(time.asInteger());
- }
- addItem(item);
- }
- else
- {
- llwarns << "Unable to import near " << name.asString() << llendl;
- rv = false;
- }
- }
- return rv;
-}
-
// This is a brute force method to rebuild the entire parent-child
// relations. The overall operation has O(NlogN) performance, which
// should be sufficient for our needs.
@@ -2186,73 +1965,6 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const
return (mID > rhs.mID);
}
-// Given the current state of the inventory items, figure out the
-// clone information. *FIX: This is sub-optimal, since we can insert
-// this information snurgically, but this makes sure the implementation
-// works before we worry about optimization.
-//void LLInventoryModel::recalculateCloneInformation()
-//{
-// //dumpInventory();
-//
-// // This implements a 'multi-map' like structure to keep track of
-// // how many clones we find.
-// typedef LLDynamicArray<LLViewerInventoryItem*> viewer_item_array_t;
-// typedef std::map<LLUUIDAndName, viewer_item_array_t*> clone_map_t;
-// clone_map_t clone_map;
-// LLUUIDAndName id_and_name;
-// viewer_item_array_t* clones = NULL;
-// LLViewerInventoryItem* item = NULL;
-// for(item = (LLViewerInventoryItem*)mItemMap.getFirstData();
-// item != NULL;
-// item = (LLViewerInventoryItem*)mItemMap.getNextData())
-// {
-// if(item->getType() == LLAssetType::AT_CALLINGCARD)
-// {
-// // if it's a calling card, we key off of the creator id, not
-// // the asset id.
-// id_and_name.mID = item->getCreatorUUID();
-// }
-// else
-// {
-// // if it's not a calling card, we key clones from the
-// // asset id.
-// id_and_name.mID = item->getAssetUUID();
-// }
-// if(id_and_name.mID == LLUUID::null)
-// {
-// continue;
-// }
-// id_and_name.mName = item->getName();
-// if(clone_map.checkData(id_and_name))
-// {
-// clones = clone_map.getData(id_and_name);
-// }
-// else
-// {
-// clones = new viewer_item_array_t;
-// clone_map.addData(id_and_name, clones);
-// }
-// clones->put(item);
-// }
-//
-// S32 count = 0;
-// for(clones = clone_map.getFirstData();
-// clones != NULL;
-// clones = clone_map.getNextData())
-// {
-// count = clones->count();
-// for(S32 i = 0; i < count; i++)
-// {
-// item = clones->get(i);
-// item->setCloneCount(count - 1);
-// //clones[i] = NULL;
-// }
-// delete clones;
-// }
-// clone_map.removeAllData();
-// //dumpInventory();
-//}
-
// static
bool LLInventoryModel::loadFromFile(const std::string& filename,
LLInventoryModel::cat_array_t& categories,
@@ -3098,6 +2810,10 @@ static LLInventoryModel::item_array_t::iterator find_item_iter_by_uuid(LLInvento
}
// static
+// * @param[in, out] items - vector with items to be updated. It should be sorted in a right way
+// * before calling this method.
+// * @param src_item_id - LLUUID of inventory item to be moved in new position
+// * @param dest_item_id - LLUUID of inventory item before which source item should be placed.
void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id)
{
LLInventoryModel::item_array_t::iterator it_src = find_item_iter_by_uuid(items, src_item_id);
@@ -3113,6 +2829,7 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c
items.insert(it_dest, src_item);
}
+//* @param[in] items vector of items in order to be saved.
void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items)
{
int sortField = 0;
@@ -3156,6 +2873,8 @@ static void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& i
std::sort(items.begin(), items.end(), sort_functor);
}
+// * @param source_item_id - LLUUID of the source item to be moved into new position
+// * @param target_item_id - LLUUID of the target item before which source item should be placed.
void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id)
{
LLInventoryModel::cat_array_t cats;
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index b7c1b57397..5f5d4d6118 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -58,17 +58,15 @@ class LLMessageSystem;
class LLInventoryCollectFunctor;
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryModel
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLInventoryModel
//
-// This class represents a collection of inventory, and provides
-// efficient ways to access that information. This class could in
-// theory be used for any place where you need inventory, though it
-// optimizes for time efficiency - not space efficiency, probably
-// making it inappropriate for use on tasks.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-
+// Represents a collection of inventory, and provides efficient ways to access
+// that information.
+// NOTE: This class could in theory be used for any place where you need
+// inventory, though it optimizes for time efficiency - not space efficiency,
+// probably making it inappropriate for use on tasks.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryModel
{
public:
@@ -84,79 +82,129 @@ public:
typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
typedef std::set<LLUUID> changed_items_t;
-
- // construction & destruction
- LLInventoryModel();
- ~LLInventoryModel();
-
- void cleanupInventory();
-
+
class fetchInventoryResponder : public LLHTTPClient::Responder
{
public:
fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
void result(const LLSD& content);
-
void error(U32 status, const std::string& reason);
-
- public:
- typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
protected:
LLSD mRequestSD;
};
- //
- // Accessors
- //
+/********************************************************************************
+ ** **
+ ** INITIALIZATION/SETUP
+ **/
- // Check if one object has a parent chain up to the category specified by UUID.
- BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const;
+ //--------------------------------------------------------------------
+ // Constructors / Destructors
+ //--------------------------------------------------------------------
+public:
+ LLInventoryModel();
+ ~LLInventoryModel();
+ void cleanupInventory();
+protected:
+ void empty(); // empty the entire contents
- // Get whatever special folder this object is a child of, if any.
- const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
+ //--------------------------------------------------------------------
+ // Initialization
+ //--------------------------------------------------------------------
+public:
+ // The inventory model usage is sensitive to the initial construction of the model
+ bool isInventoryUsable() const;
+private:
+ bool mIsAgentInvUsable; // used to handle an invalid inventory state
- // Get the object by id. Returns NULL if not found.
- // * WARNING: use the pointer returned for read operations - do
- // not modify the object values in place or you will break stuff.
- LLInventoryObject* getObject(const LLUUID& id) const;
+ //--------------------------------------------------------------------
+ // Root Folders
+ //--------------------------------------------------------------------
+public:
+ // The following are set during login with data from the server
+ void setRootFolderID(const LLUUID& id);
+ void setLibraryOwnerID(const LLUUID& id);
+ void setLibraryRootFolderID(const LLUUID& id);
- // Get the item by id. Returns NULL if not found.
- // * WARNING: use the pointer for read operations - use the
- // updateItem() method to actually modify values.
- LLViewerInventoryItem* getItem(const LLUUID& id) const;
+ const LLUUID &getRootFolderID() const;
+ const LLUUID &getLibraryOwnerID() const;
+ const LLUUID &getLibraryRootFolderID() const;
+private:
+ LLUUID mRootFolderID;
+ LLUUID mLibraryRootFolderID;
+ LLUUID mLibraryOwnerID;
+
+ //--------------------------------------------------------------------
+ // Structure
+ //--------------------------------------------------------------------
+public:
+ // Methods to load up inventory skeleton & meat. These are used
+ // during authentication. Returns true if everything parsed.
+ bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
+ void buildParentChildMap(); // brute force method to rebuild the entire parent-child relations
+ // Call on logout to save a terse representation.
+ void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
+private:
+ // Information for tracking the actual inventory. We index this
+ // information in a lot of different ways so we can access
+ // the inventory using several different identifiers.
+ // mInventory member data is the 'master' list of inventory, and
+ // mCategoryMap and mItemMap store uuid->object mappings.
+ typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
+ typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
+ cat_map_t mCategoryMap;
+ item_map_t mItemMap;
+ // This last set of indices is used to map parents to children.
+ typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
+ typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
+ parent_cat_map_t mParentChildCategoryTree;
+ parent_item_map_t mParentChildItemTree;
- // Get the category by id. Returns NULL if not found.
- // * WARNING: use the pointer for read operations - use the
- // updateCategory() method to actually modify values.
- LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
+ //--------------------------------------------------------------------
+ // Login
+ //--------------------------------------------------------------------
+public:
+ static BOOL getIsFirstTimeInViewer2();
+private:
+ static BOOL sFirstTimeInViewer2;
+ const static S32 sCurrentInvCacheVersion; // expected inventory cache version
- // Return the number of items or categories
- S32 getItemCount() const;
- S32 getCategoryCount() const;
+/** Initialization/Setup
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** ACCESSORS
+ **/
+
+ //--------------------------------------------------------------------
+ // Descendents
+ //--------------------------------------------------------------------
+public:
+ // Make sure we have the descendents in the structure. Returns true
+ // if a fetch was performed.
+ bool fetchDescendentsOf(const LLUUID& folder_id) const;
// Return the direct descendents of the id provided.Set passed
// in values to NULL if the call fails.
- // *WARNING: The array provided points straight into the guts of
- // this object, and should only be used for read operations, since
- // modifications may invalidate the internal state of the
- // inventory.
+ // NOTE: The array provided points straight into the guts of
+ // this object, and should only be used for read operations, since
+ // modifications may invalidate the internal state of the inventory.
void getDirectDescendentsOf(const LLUUID& cat_id,
cat_array_t*& categories,
item_array_t*& items) const;
- // SJB: Added version to lock the arrays to catch potential logic bugs
- void lockDirectDescendentArrays(const LLUUID& cat_id,
- cat_array_t*& categories,
- item_array_t*& items);
- void unlockDirectDescendentArrays(const LLUUID& cat_id);
-
// Starting with the object specified, add its descendents to the
// array provided, but do not add the inventory object specified
- // by id. There is no guaranteed order. Neither array will be
- // erased before adding objects to it. Do not store a copy of the
- // pointers collected - use them, and collect them again later if
- // you need to reference the same objects.
- enum { EXCLUDE_TRASH = FALSE, INCLUDE_TRASH = TRUE };
+ // by id. There is no guaranteed order.
+ // NOTE: Neither array will be erased before adding objects to it.
+ // Do not store a copy of the pointers collected - use them, and
+ // collect them again later if you need to reference the same objects.
+ enum {
+ EXCLUDE_TRASH = FALSE,
+ INCLUDE_TRASH = TRUE
+ };
void collectDescendents(const LLUUID& id,
cat_array_t& categories,
item_array_t& items,
@@ -172,156 +220,162 @@ public:
// Assumes item_id is itself not a linked item.
item_array_t collectLinkedItems(const LLUUID& item_id,
const LLUUID& start_folder_id = LLUUID::null);
+
- // Get the inventoryID that this item points to, else just return item_id
+ // Check if one object has a parent chain up to the category specified by UUID.
+ BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const;
+
+ //--------------------------------------------------------------------
+ // Find
+ //--------------------------------------------------------------------
+public:
+ // Returns the uuid of the category that specifies 'type' as what it
+ // defaults to containing. The category is not necessarily only for that type.
+ // NOTE: If create_folder is true, this will create a new inventory category
+ // on the fly if one does not exist. *NOTE: if find_in_library is true it
+ // will search in the user's library folder instead of "My Inventory"
+ const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type,
+ bool create_folder = true,
+ bool find_in_library = false);
+
+ // Get whatever special folder this object is a child of, if any.
+ const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
+
+ // Get the object by id. Returns NULL if not found.
+ // NOTE: Use the pointer returned for read operations - do
+ // not modify the object values in place or you will break stuff.
+ LLInventoryObject* getObject(const LLUUID& id) const;
+
+ // Get the item by id. Returns NULL if not found.
+ // NOTE: Use the pointer for read operations - use the
+ // updateItem() method to actually modify values.
+ LLViewerInventoryItem* getItem(const LLUUID& id) const;
+
+ // Get the category by id. Returns NULL if not found.
+ // NOTE: Use the pointer for read operations - use the
+ // updateCategory() method to actually modify values.
+ LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
+
+ // Get the inventoryID that this item points to, else just return item_id.
const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
+private:
+ mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups
- // The inventory model usage is sensitive to the initial construction of the
- // model.
- bool isInventoryUsable() const;
+ //--------------------------------------------------------------------
+ // Count
+ //--------------------------------------------------------------------
+public:
+ // Return the number of items or categories
+ S32 getItemCount() const;
+ S32 getCategoryCount() const;
+
+/** Accessors
+ ** **
+ *******************************************************************************/
- //
- // Mutators
- //
+/********************************************************************************
+ ** **
+ ** MUTATORS
+ **/
- // Calling this method with an inventory item will either change
- // an existing item with a matching item_id, or will add the item
+public:
+ // Change an existing item with a matching item_id or add the item
// to the current inventory. Returns the change mask generated by
// the update. No notification will be sent to observers. This
// method will only generate network traffic if the item had to be
// reparented.
- // *NOTE: In usage, you will want to perform cache accounting
- // operations in LLInventoryModel::accountForUpdate() or
- // LLViewerInventoryItem::updateServer() before calling this
- // method.
+ // NOTE: In usage, you will want to perform cache accounting
+ // operations in LLInventoryModel::accountForUpdate() or
+ // LLViewerInventoryItem::updateServer() before calling this method.
U32 updateItem(const LLViewerInventoryItem* item);
- // Calling this method with an inventory category will either
- // change an existing item with the matching id, or it will add
+ // Change an existing item with the matching id or add
// the category. No notifcation will be sent to observers. This
// method will only generate network traffic if the item had to be
// reparented.
- // *NOTE: In usage, you will want to perform cache accounting
- // operations in LLInventoryModel::accountForUpdate() or
- // LLViewerInventoryCategory::updateServer() before calling this
- // method.
+ // NOTE: In usage, you will want to perform cache accounting
+ // operations in accountForUpdate() or LLViewerInventoryCategory::
+ // updateServer() before calling this method.
void updateCategory(const LLViewerInventoryCategory* cat);
- // This method will move the specified object id to the specified
- // category, update the internal structures. No cache accounting,
+ // Move the specified object id to the specified category and
+ // update the internal structures. No cache accounting,
// observer notification, or server update is performed.
void moveObject(const LLUUID& object_id, const LLUUID& cat_id);
- // delete a particular inventory object by ID. This will purge one
- // object from the internal data structures maintaining a
+ //--------------------------------------------------------------------
+ // Delete
+ //--------------------------------------------------------------------
+public:
+ // Delete a particular inventory object by ID. Will purge one
+ // object from the internal data structures, maintaining a
// consistent internal state. No cache accounting, observer
- // notification, or server update is performed. Purges linked items.
+ // notification, or server update is performed.
void deleteObject(const LLUUID& id);
+ void removeItem(const LLUUID& item_id);
- // delete a particular inventory object by ID, and delete it from
- // the server. Also updates linked items.
+ // Delete a particular inventory object by ID, and delete it from
+ // the server. Also updates linked items.
void purgeObject(const LLUUID& id);
- void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id);
- // This is a method which collects the descendants of the id
+ // Collects and purges the descendants of the id
// provided. If the category is not found, no action is
// taken. This method goes through the long winded process of
// removing server representation of folders and items while doing
// cache accounting in a fairly efficient manner. This method does
// not notify observers (though maybe it should...)
void purgeDescendentsOf(const LLUUID& id);
+protected:
+ void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id);
+
+ //--------------------------------------------------------------------
+ // Reorder
+ //--------------------------------------------------------------------
+public:
+ // Changes items order by insertion of the item identified by src_item_id
+ // before the item identified by dest_item_id. Both items must exist in items array.
+ // Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id.
+ static void updateItemsOrder(LLInventoryModel::item_array_t& items,
+ const LLUUID& src_item_id,
+ const LLUUID& dest_item_id);
+
+ // Saves current order of the passed items using inventory item sort field.
+ // Resets 'items' sort fields and saves them on server.
+ // Is used to save order for Favorites folder.
+ void saveItemsOrder(const LLInventoryModel::item_array_t& items);
- // This method optimally removes the referenced categories and
- // items from the current agent's inventory in the database. It
- // performs all of the during deletion. The local representation
- // is not removed.
- void deleteFromServer(LLDynamicArray<LLUUID>& category_ids,
- LLDynamicArray<LLUUID>& item_ids);
-
- // Add/remove an observer. If the observer is destroyed, be sure
- // to remove it.
- void addObserver(LLInventoryObserver* observer);
- void removeObserver(LLInventoryObserver* observer);
- BOOL containsObserver(LLInventoryObserver* observer) const;
-
- //
- // Misc Methods
- //
-
- // findCategoryUUIDForType() returns the uuid of the category that
- // specifies 'type' as what it defaults to containing. The
- // category is not necessarily only for that type. *NOTE: If create_folder is true, this
- // will create a new inventory category on the fly if one does not exist. *NOTE: if find_in_library is
- // true it will search in the user's library folder instead of "My Inventory"
- // SDK: Added flag to specify whether the folder should be created if not found. This fixes the horrible
- // multiple trash can bug.
- const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder = true, bool find_in_library = false);
-
- // This gets called by the idle loop. It only updates if new
- // state is detected. Call notifyObservers() manually to update
- // regardless of whether state change has been indicated.
- void idleNotifyObservers();
-
- // Call this method to explicitly update everyone on a new state.
- // The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328]
- void notifyObservers(const std::string service_name="");
-
- // This allows outsiders to tell the inventory if something has
- // been changed 'under the hood', but outside the control of the
- // inventory. For example, if we grant someone modify permissions,
- // then that changes the data structures for LLAvatarTracker, but
- // potentially affects inventory observers. This API makes sure
- // that the next notify will include that notification.
- void addChangedMask(U32 mask, const LLUUID& referent);
-
- const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
-
- // This method to prepares a set of mock inventory which provides
- // minimal functionality before the actual arrival of inventory.
- //void mock(const LLUUID& root_id);
-
- // Make sure we have the descendents in the structure. Returns true
- // if a fetch was performed.
- bool fetchDescendentsOf(const LLUUID& folder_id);
-
- // call this method to request the inventory.
- //void requestFromServer(const LLUUID& agent_id);
-
- // call this method on logout to save a terse representation
- void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
-
- // Generates a string containing the path to the item specified by
- // item_id.
- void appendPath(const LLUUID& id, std::string& path) const;
-
- // message handling functionality
- static void registerCallbacks(LLMessageSystem* msg);
+ // Rearranges Landmarks inside Favorites folder.
+ // Moves source landmark before target one.
+ void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
- // Convenience function to create a new category. You could call
- // updateCatgory() with a newly generated UUID category, but this
- // version will take care of details like what the name should be
- // based on preferred type. Returns the UUID of the new
- // category. If you want to use the default name based on type,
- // pass in a NULL to the 'name parameter.
+ //--------------------------------------------------------------------
+ // Creation
+ //--------------------------------------------------------------------
+public:
+ // Returns the UUID of the new category. If you want to use the default
+ // name based on type, pass in a NULL to the 'name' parameter.
LLUUID createNewCategory(const LLUUID& parent_id,
LLFolderType::EType preferred_type,
const std::string& name);
+protected:
+ // Internal methods that add inventory and make sure that all of
+ // the internal data structures are consistent. These methods
+ // should be passed pointers of newly created objects, and the
+ // instance will take over the memory management from there.
+ void addCategory(LLViewerInventoryCategory* category);
+ void addItem(LLViewerInventoryItem* item);
+
+/** Mutators
+ ** **
+ *******************************************************************************/
- // methods to load up inventory skeleton & meat. These are used
- // during authentication. return true if everything parsed.
- bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
- bool loadMeat(const LLSD& options, const LLUUID& owner_id);
-
- // This is a brute force method to rebuild the entire parent-child
- // relations.
- void buildParentChildMap();
-
- //
- // Category accounting.
- //
+/********************************************************************************
+ ** **
+ ** CATEGORY ACCOUNTING
+ **/
- // This structure represents the number of items added or removed
- // from a category.
+public:
+ // Represents the number of items added or removed from a category.
struct LLCategoryUpdate
{
LLCategoryUpdate() : mDescendentDelta(0) {}
@@ -333,8 +387,7 @@ public:
};
typedef std::vector<LLCategoryUpdate> update_list_t;
- // This structure eixts to make it easier to account for deltas in
- // a map.
+ // This exists to make it easier to account for deltas in a map.
struct LLInitializedS32
{
LLInitializedS32() : mValue(0) {}
@@ -345,102 +398,89 @@ public:
};
typedef std::map<LLUUID, LLInitializedS32> update_map_t;
- // Call these methods when there are category updates, but call
- // them *before* the actual update so the method can do descendent
- // accounting correctly.
+ // Call when there are category updates. Call them *before* the
+ // actual update so the method can do descendent accounting correctly.
void accountForUpdate(const LLCategoryUpdate& update) const;
void accountForUpdate(const update_list_t& updates);
void accountForUpdate(const update_map_t& updates);
- // Return child status of category children. yes/no/maybe
+ // Return (yes/no/maybe) child status of category children.
EHasChildren categoryHasChildren(const LLUUID& cat_id) const;
- // returns true iff category version is known and theoretical
+ // Returns true iff category version is known and theoretical
// descendents == actual descendents.
bool isCategoryComplete(const LLUUID& cat_id) const;
- // callbacks
- // Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed
- void emptyFolderType(const std::string notification, LLFolderType::EType folder_type);
- bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type);
-
- // Utility Functions
- void removeItem(const LLUUID& item_id);
-
- // Data about the agent's root folder and root library folder
- // are stored here, rather than in LLAgent where it used to be, because
- // gInventory is a singleton and represents the agent's inventory.
- // The "library" is actually the inventory of a special agent,
- // usually Alexandria Linden.
- const LLUUID &getRootFolderID() const;
- const LLUUID &getLibraryOwnerID() const;
- const LLUUID &getLibraryRootFolderID() const;
-
- // These are set during login with data from the server
- void setRootFolderID(const LLUUID& id);
- void setLibraryOwnerID(const LLUUID& id);
- void setLibraryRootFolderID(const LLUUID& id);
+/** Category Accounting
+ ** **
+ *******************************************************************************/
+/********************************************************************************
+ ** **
+ ** NOTIFICATIONS
+ **/
- /**
- * Changes items order by insertion of the item identified by src_item_id
- * BEFORE the item identified by dest_item_id. Both items must exist in items array.
- *
- * Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id.
- *
- * @param[in, out] items - vector with items to be updated. It should be sorted in a right way
- * before calling this method.
- * @param src_item_id - LLUUID of inventory item to be moved in new position
- * @param dest_item_id - LLUUID of inventory item before which source item should be placed.
- */
- static void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id);
-
- /**
- * Saves current order of the passed items using inventory item sort field.
- *
- * It reset items' sort fields and saves them on server.
- * Is used to save order for Favorites folder.
- *
- * @param[in] items vector of items in order to be saved.
- */
- void saveItemsOrder(const LLInventoryModel::item_array_t& items);
+public:
+ // Called by the idle loop. Only updates if new state is detected. Call
+ // notifyObservers() manually to update regardless of whether state change
+ // has been indicated.
+ void idleNotifyObservers();
- /**
- * Rearranges Landmarks inside Favorites folder.
- * Moves source landmark before target one.
- *
- * @param source_item_id - LLUUID of the source item to be moved into new position
- * @param target_item_id - LLUUID of the target item before which source item should be placed.
- */
- void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
+ // Call to explicitly update everyone on a new state. The optional argument
+ // 'service_name' is used by Agent Inventory Service [DEV-20328]
+ void notifyObservers(const std::string service_name="");
+ // Allows outsiders to tell the inventory if something has
+ // been changed 'under the hood', but outside the control of the
+ // inventory. The next notify will include that notification.
+ void addChangedMask(U32 mask, const LLUUID& referent);
+ const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
protected:
+ // Updates all linked items pointing to this id.
+ void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
+private:
+ // Flag set when notifyObservers is being called, to look for bugs
+ // where it's called recursively.
+ BOOL mIsNotifyObservers;
+ // Variables used to track what has changed since the last notify.
+ U32 mModifyMask;
+ changed_items_t mChangedItemIDs;
+
+ //--------------------------------------------------------------------
+ // Observers
+ //--------------------------------------------------------------------
+public:
+ // If the observer is destroyed, be sure to remove it.
+ void addObserver(LLInventoryObserver* observer);
+ void removeObserver(LLInventoryObserver* observer);
+ BOOL containsObserver(LLInventoryObserver* observer) const;
+private:
+ typedef std::set<LLInventoryObserver*> observer_list_t;
+ observer_list_t mObservers;
+
+/** Notifications
+ ** **
+ *******************************************************************************/
- // Internal methods which add inventory and make sure that all of
- // the internal data structures are consistent. These methods
- // should be passed pointers of newly created objects, and the
- // instance will take over the memory management from there.
- void addCategory(LLViewerInventoryCategory* category);
- void addItem(LLViewerInventoryItem* item);
-
- // ! DEPRECRATE ! Remove this and add it into findCategoryUUIDForType,
- // since that's the only function that uses this. It's too confusing
- // having both methods.
- //
- // Internal method which looks for a category with the specified
- // preferred type. Returns LLUUID::null if not found
- const LLUUID &findCatUUID(LLFolderType::EType preferred_type, bool find_in_library = false) const;
- // Empty the entire contents
- void empty();
+/********************************************************************************
+ ** **
+ ** MISCELLANEOUS
+ **/
- // Given the current state of the inventory items, figure out the
- // clone information. *FIX: This is sub-optimal, since we can
- // insert this information snurgically, but this makes sure the
- // implementation works before we worry about optimization.
- //void recalculateCloneInformation();
+ //--------------------------------------------------------------------
+ // Callbacks
+ //--------------------------------------------------------------------
+public:
+ // Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed
+ void emptyFolderType(const std::string notification, LLFolderType::EType folder_type);
+ bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type);
+ static void registerCallbacks(LLMessageSystem* msg);
- // file import/export.
+ //--------------------------------------------------------------------
+ // File I/O
+ //--------------------------------------------------------------------
+protected:
static bool loadFromFile(const std::string& filename,
cat_array_t& categories,
item_array_t& items,
@@ -449,86 +489,46 @@ protected:
const cat_array_t& categories,
const item_array_t& items);
- // message handling functionality
- //static void processUseCachedInventory(LLMessageSystem* msg, void**);
+ //--------------------------------------------------------------------
+ // Message handling functionality
+ //--------------------------------------------------------------------
+public:
static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**);
static void processRemoveInventoryItem(LLMessageSystem* msg, void**);
static void processUpdateInventoryFolder(LLMessageSystem* msg, void**);
static void processRemoveInventoryFolder(LLMessageSystem* msg, void**);
- //static void processExchangeCallingcard(LLMessageSystem* msg, void**);
- //static void processAddCallingcard(LLMessageSystem* msg, void**);
- //static void processDeclineCallingcard(LLMessageSystem* msg, void**);
static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**);
static void processBulkUpdateInventory(LLMessageSystem* msg, void**);
static void processInventoryDescendents(LLMessageSystem* msg, void**);
static void processMoveInventoryItem(LLMessageSystem* msg, void**);
static void processFetchInventoryReply(LLMessageSystem* msg, void**);
-
+protected:
bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting);
- // Updates all linked items pointing to this id.
- void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
-
+ //--------------------------------------------------------------------
+ // Locks
+ //--------------------------------------------------------------------
+public:
+ void lockDirectDescendentArrays(const LLUUID& cat_id,
+ cat_array_t*& categories,
+ item_array_t*& items);
+ void unlockDirectDescendentArrays(const LLUUID& cat_id);
protected:
cat_array_t* getUnlockedCatArray(const LLUUID& id);
item_array_t* getUnlockedItemArray(const LLUUID& id);
-
private:
- // Variables used to track what has changed since the last notify.
- U32 mModifyMask;
- changed_items_t mChangedItemIDs;
-
std::map<LLUUID, bool> mCategoryLock;
std::map<LLUUID, bool> mItemLock;
- // cache recent lookups
- mutable LLPointer<LLViewerInventoryItem> mLastItem;
-
- // This last set of indices is used to map parents to children.
- typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
- typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
- parent_cat_map_t mParentChildCategoryTree;
- parent_item_map_t mParentChildItemTree;
-
- typedef std::set<LLInventoryObserver*> observer_list_t;
- observer_list_t mObservers;
-
- // Agent inventory folder information.
- LLUUID mRootFolderID;
- LLUUID mLibraryRootFolderID;
- LLUUID mLibraryOwnerID;
-
- // Expected inventory cache version
- const static S32 sCurrentInvCacheVersion;
-
- // This flag is used to handle an invalid inventory state.
- bool mIsAgentInvUsable;
-
-private:
- // Information for tracking the actual inventory. We index this
- // information in a lot of different ways so we can access
- // the inventory using several different identifiers.
- // mInventory member data is the 'master' list of inventory, and
- // mCategoryMap and mItemMap store uuid->object mappings.
- typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
- typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
- //inv_map_t mInventory;
- cat_map_t mCategoryMap;
- item_map_t mItemMap;
-
- // Flag set when notifyObservers is being called, to look for bugs
- // where it's called recursively.
- BOOL mIsNotifyObservers;
+ //--------------------------------------------------------------------
+ // Debugging
+ //--------------------------------------------------------------------
public:
- // *NOTE: DEBUG functionality
void dumpInventory() const;
- ////////////////////////////////////////////////////////////////////////////////
- // Login status
-public:
- static BOOL getIsFirstTimeInViewer2();
-private:
- static BOOL sFirstTimeInViewer2;
+/** Miscellaneous
+ ** **
+ *******************************************************************************/
};
// a special inventory model for the agent
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index cfbc2c3e05..0ff6ab2644 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -46,26 +46,11 @@
const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f;
const S32 MAX_FETCH_RETRIES = 10;
-// RN: for some reason, using std::queue in the header file confuses the compiler which thinks it's an xmlrpc_queue
-static std::deque<LLUUID> sFetchQueue;
-bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id)
-{
- for (std::deque<LLUUID>::iterator it = sFetchQueue.begin();
- it != sFetchQueue.end(); ++it)
- {
- const LLUUID& fetch_id = *it;
- if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
- return false;
- }
- return true;
-}
-
-
LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
mBackgroundFetchActive(FALSE),
mAllFoldersFetched(FALSE),
- mInventoryFetchStarted(FALSE),
- mLibraryFetchStarted(FALSE),
+ mRecursiveInventoryFetchStarted(FALSE),
+ mRecursiveLibraryFetchStarted(FALSE),
mNumFetchRetries(0),
mMinTimeBetweenFetches(0.3f),
mMaxTimeBetweenFetches(10.f),
@@ -80,12 +65,12 @@ LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete()
{
- return sFetchQueue.empty() && mBulkFetchCount<=0;
+ return mFetchQueue.empty() && mBulkFetchCount<=0;
}
bool LLInventoryModelBackgroundFetch::libraryFetchStarted()
{
- return mLibraryFetchStarted;
+ return mRecursiveLibraryFetchStarted;
}
bool LLInventoryModelBackgroundFetch::libraryFetchCompleted()
@@ -100,7 +85,7 @@ bool LLInventoryModelBackgroundFetch::libraryFetchInProgress()
bool LLInventoryModelBackgroundFetch::inventoryFetchStarted()
{
- return mInventoryFetchStarted;
+ return mRecursiveInventoryFetchStarted;
}
bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted()
@@ -123,41 +108,41 @@ BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive()
return mBackgroundFetchActive;
}
-void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id)
+void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive)
{
if (!mAllFoldersFetched)
{
mBackgroundFetchActive = TRUE;
if (cat_id.isNull())
{
- if (!mInventoryFetchStarted)
+ if (!mRecursiveInventoryFetchStarted)
{
- mInventoryFetchStarted = TRUE;
- sFetchQueue.push_back(gInventory.getRootFolderID());
+ mRecursiveInventoryFetchStarted |= recursive;
+ mFetchQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), recursive));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
- if (!mLibraryFetchStarted)
+ if (!mRecursiveLibraryFetchStarted)
{
- mLibraryFetchStarted = TRUE;
- sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
+ mRecursiveLibraryFetchStarted |= recursive;
+ mFetchQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursive));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
else
{
// specific folder requests go to front of queue
- if (sFetchQueue.empty() || sFetchQueue.front() != cat_id)
+ if (mFetchQueue.empty() || mFetchQueue.front().mCatUUID != cat_id)
{
- sFetchQueue.push_front(cat_id);
+ mFetchQueue.push_front(FetchQueueInfo(cat_id, recursive));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
if (cat_id == gInventory.getLibraryRootFolderID())
{
- mLibraryFetchStarted = TRUE;
+ mRecursiveLibraryFetchStarted |= recursive;
}
if (cat_id == gInventory.getRootFolderID())
{
- mInventoryFetchStarted = TRUE;
+ mRecursiveInventoryFetchStarted |= recursive;
}
}
}
@@ -166,7 +151,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id)
void LLInventoryModelBackgroundFetch::findLostItems()
{
mBackgroundFetchActive = TRUE;
- sFetchQueue.push_back(LLUUID::null);
+ mFetchQueue.push_back(FetchQueueInfo(LLUUID::null, TRUE));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
@@ -183,8 +168,8 @@ void LLInventoryModelBackgroundFetch::stopBackgroundFetch()
void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
{
- if (mInventoryFetchStarted &&
- mLibraryFetchStarted)
+ if (mRecursiveInventoryFetchStarted &&
+ mRecursiveLibraryFetchStarted)
{
mAllFoldersFetched = TRUE;
}
@@ -210,7 +195,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
//DEPRECATED OLD CODE FOLLOWS.
// no more categories to fetch, stop fetch process
- if (sFetchQueue.empty())
+ if (mFetchQueue.empty())
{
llinfos << "Inventory fetch completed" << llendl;
@@ -232,7 +217,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
while(1)
{
- if (sFetchQueue.empty())
+ if (mFetchQueue.empty())
{
break;
}
@@ -243,12 +228,13 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
break;
}
- LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
+ const FetchQueueInfo info = mFetchQueue.front();
+ LLViewerInventoryCategory* cat = gInventory.getCategory(info.mCatUUID);
// category has been deleted, remove from queue.
if (!cat)
{
- sFetchQueue.pop_front();
+ mFetchQueue.pop_front();
continue;
}
@@ -271,10 +257,10 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
}
}
// do I have all my children?
- else if (gInventory.isCategoryComplete(sFetchQueue.front()))
+ else if (gInventory.isCategoryComplete(info.mCatUUID))
{
// finished with this category, remove from queue
- sFetchQueue.pop_front();
+ mFetchQueue.pop_front();
// add all children to queue
LLInventoryModel::cat_array_t* categories;
@@ -284,7 +270,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
it != categories->end();
++it)
{
- sFetchQueue.push_back((*it)->getUUID());
+ mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive));
}
// we received a response in less than the fast time
@@ -303,13 +289,12 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
{
// received first packet, but our num descendants does not match db's num descendants
// so try again later
- LLUUID fetch_id = sFetchQueue.front();
- sFetchQueue.pop_front();
+ mFetchQueue.pop_front();
if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
{
// push on back of queue
- sFetchQueue.push_back(fetch_id);
+ mFetchQueue.push_back(info);
}
mTimelyFetchPending = FALSE;
mFetchTimer.reset();
@@ -334,20 +319,25 @@ void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching)
class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
{
- public:
- LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
- //LLInventoryModelFetchDescendentsResponder() {};
- void result(const LLSD& content);
- void error(U32 status, const std::string& reason);
- public:
- typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
- protected:
- LLSD mRequestSD;
+public:
+ LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd, uuid_vec_t recursive_cats) :
+ mRequestSD(request_sd),
+ mRecursiveCatUUIDs(recursive_cats)
+ {};
+ //LLInventoryModelFetchDescendentsResponder() {};
+ void result(const LLSD& content);
+ void error(U32 status, const std::string& reason);
+protected:
+ BOOL getIsRecursive(const LLUUID& cat_id) const;
+private:
+ LLSD mRequestSD;
+ uuid_vec_t mRecursiveCatUUIDs; // Hack for storing away which cat fetches are recursive.
};
//If we get back a normal response, handle it here
-void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
+void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
{
+ LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
if (content.has("folders"))
{
@@ -412,11 +402,12 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
{
LLSD category = *category_it;
tcategory->fromLLSD(category);
-
- if (LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted() ||
- LLInventoryModelBackgroundFetch::instance().libraryFetchStarted())
+
+ const BOOL recursive = getIsRecursive(tcategory->getUUID());
+
+ if (recursive)
{
- sFetchQueue.push_back(tcategory->getUUID());
+ fetcher->mFetchQueue.push_back(LLInventoryModelBackgroundFetch::FetchQueueInfo(tcategory->getUUID(), recursive));
}
else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) )
{
@@ -461,12 +452,12 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
}
}
- LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
+ fetcher->incrBulkFetch(-1);
- if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
+ if (fetcher->isBulkFetchProcessingComplete())
{
llinfos << "Inventory fetch completed" << llendl;
- LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
+ fetcher->setAllFoldersFetched();
}
gInventory.notifyObservers("fetchDescendents");
@@ -475,12 +466,14 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
//If we get back an error (not found, etc...), handle it here
void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason)
{
+ LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
+
llinfos << "LLInventoryModelFetchDescendentsResponder::error "
<< status << ": " << reason << llendl;
- LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
+ fetcher->incrBulkFetch(-1);
- if (status==499) //timed out. Let's be awesome!
+ if (status==499) // Timed out.
{
for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
folder_it != mRequestSD["folders"].endArray();
@@ -488,24 +481,30 @@ void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::str
{
LLSD folder_sd = *folder_it;
LLUUID folder_id = folder_sd["folder_id"];
- sFetchQueue.push_front(folder_id);
+ const BOOL recursive = getIsRecursive(folder_id);
+ fetcher->mFetchQueue.push_front(LLInventoryModelBackgroundFetch::FetchQueueInfo(folder_id, recursive));
}
}
else
{
- if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
+ if (fetcher->isBulkFetchProcessingComplete())
{
- LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
+ fetcher->setAllFoldersFetched();
}
}
gInventory.notifyObservers("fetchDescendents");
}
+BOOL LLInventoryModelFetchDescendentsResponder::getIsRecursive(const LLUUID& cat_id) const
+{
+ return (std::find(mRecursiveCatUUIDs.begin(),mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end());
+}
+
//static Bundle up a bunch of requests to send all at once.
void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
{
//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
- //If there are items in sFetchQueue, we want to check the time since the last bulkFetch was
+ //If there are items in mFetchQueue, we want to check the time since the last bulkFetch was
//sent. If it exceeds our retry time, go ahead and fire off another batch.
//Stopbackgroundfetch will be run from the Responder instead of here.
@@ -528,11 +527,16 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1;
+ uuid_vec_t recursive_cats;
+
LLSD body;
LLSD body_lib;
- while (!(sFetchQueue.empty()) && (folder_count < max_batch_size))
+
+ while (!(mFetchQueue.empty()) && (folder_count < max_batch_size))
{
- if (sFetchQueue.front().isNull()) //DEV-17797
+ const FetchQueueInfo& fetch_info = mFetchQueue.front();
+ const LLUUID &cat_id = fetch_info.mCatUUID;
+ if (cat_id.isNull()) //DEV-17797
{
LLSD folder_sd;
folder_sd["folder_id"] = LLUUID::null.asString();
@@ -545,7 +549,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
}
else
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
if (cat)
{
@@ -564,9 +568,9 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
body["folders"].append(folder_sd);
folder_count++;
}
- if (mInventoryFetchStarted || mLibraryFetchStarted)
- { //Already have this folder but append child folders to list.
- // add all children to queue
+ // May already have this folder, but append child folders to list.
+ if (fetch_info.mRecursive)
+ {
LLInventoryModel::cat_array_t* categories;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
@@ -574,12 +578,15 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
it != categories->end();
++it)
{
- sFetchQueue.push_back((*it)->getUUID());
+ mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
}
}
}
}
- sFetchQueue.pop_front();
+ if (fetch_info.mRecursive)
+ recursive_cats.push_back(cat_id);
+
+ mFetchQueue.pop_front();
}
if (folder_count > 0)
@@ -587,12 +594,15 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
mBulkFetchCount++;
if (body["folders"].size())
{
- LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0);
+ LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body, recursive_cats);
+ LLHTTPClient::post(url, body, fetcher, 300.0);
}
if (body_lib["folders"].size())
{
std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
- LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0);
+
+ LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats);
+ LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0);
}
mFetchTimer.reset();
}
@@ -601,3 +611,17 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
setAllFoldersFetched();
}
}
+
+bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const
+{
+ for (fetch_queue_t::const_iterator it = mFetchQueue.begin();
+ it != mFetchQueue.end(); ++it)
+ {
+ const LLUUID& fetch_id = (*it).mCatUUID;
+ if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
+ return false;
+ }
+ return true;
+}
+
+
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index 94606fae23..c1e37eda8f 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -68,13 +68,15 @@ class LLInventoryCollectFunctor;
class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch>
{
+ friend class LLInventoryModelFetchDescendentsResponder;
+
public:
LLInventoryModelBackgroundFetch();
~LLInventoryModelBackgroundFetch();
// Start and stop background breadth-first fetching of inventory contents.
// This gets triggered when performing a filter-search
- void start(const LLUUID& cat_id = LLUUID::null);
+ void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE);
BOOL backgroundFetchActive();
bool isEverythingFetched();
void incrBulkFetch(S16 fetching);
@@ -98,9 +100,20 @@ public:
static void backgroundFetchCB(void*); // background fetch idle function
void backgroundFetch();
+ struct FetchQueueInfo
+ {
+ FetchQueueInfo(const LLUUID& id, BOOL recursive) :
+ mCatUUID(id), mRecursive(recursive)
+ {
+ }
+ LLUUID mCatUUID;
+ BOOL mRecursive;
+ };
+protected:
+ bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
private:
- BOOL mInventoryFetchStarted;
- BOOL mLibraryFetchStarted;
+ BOOL mRecursiveInventoryFetchStarted;
+ BOOL mRecursiveLibraryFetchStarted;
BOOL mAllFoldersFetched;
// completing the fetch once per session should be sufficient
@@ -113,6 +126,8 @@ private:
F32 mMinTimeBetweenFetches;
F32 mMaxTimeBetweenFetches;
+ typedef std::deque<FetchQueueInfo> fetch_queue_t;
+ fetch_queue_t mFetchQueue;
};
#endif // LL_LLINVENTORYMODELBACKGROUNDFETCH_H
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 15c872a7c4..000bcdd265 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -775,8 +775,7 @@ void LLInventoryPanel::doCreate(const LLSD& userdata)
bool LLInventoryPanel::beginIMSession()
{
- std::set<LLUUID> selected_items;
- mFolderRoot->getSelectionList(selected_items);
+ std::set<LLUUID> selected_items = mFolderRoot->getSelectionList();
std::string name;
static int session_num = 1;
@@ -873,8 +872,7 @@ bool LLInventoryPanel::beginIMSession()
bool LLInventoryPanel::attachObject(const LLSD& userdata)
{
- std::set<LLUUID> selected_items;
- mFolderRoot->getSelectionList(selected_items);
+ std::set<LLUUID> selected_items = mFolderRoot->getSelectionList();
std::string joint_name = userdata.asString();
LLViewerJointAttachment* attachmentp = NULL;
@@ -1001,3 +999,30 @@ BOOL LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) co
{
return (std::find(mHiddenFolderTypes.begin(), mHiddenFolderTypes.end(), folder_type) != mHiddenFolderTypes.end());
}
+
+
+/************************************************************************/
+/* Recent Inventory Panel related class */
+/************************************************************************/
+class LLInventoryRecentItemsPanel;
+static LLDefaultChildRegistry::Register<LLInventoryRecentItemsPanel> t_recent_inventory_panel("recent_inventory_panel");
+
+static const LLRecentInventoryBridgeBuilder RECENT_ITEMS_BUILDER;
+class LLInventoryRecentItemsPanel : public LLInventoryPanel
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLInventoryPanel::Params>
+ {};
+
+protected:
+ LLInventoryRecentItemsPanel (const Params&);
+ friend class LLUICtrlFactory;
+};
+
+LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params)
+: LLInventoryPanel(params)
+{
+ // replace bridge builder to have necessary View bridges.
+ mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER;
+}
+
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index 7336efb62a..539ca97a93 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -299,7 +299,7 @@ void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slur
bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
if (gotSimName)
{
- std::string slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
+ std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
cb(slurl);
return;
@@ -351,7 +351,7 @@ void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb,
bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
if (gotSimName)
{
- slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
+ slurl = LLSLURL(sim_name, global_pos).getSLURLString();
}
else
{
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 7abb4f4f16..53a11eff04 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -683,9 +683,8 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
value["item_type"] = TELEPORT_HISTORY;
value["global_pos"] = result->mGlobalPos.getValue();
std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
- //TODO*: add slurl to teleportitem or parse region name from title
- value["tooltip"] = LLSLURL::buildSLURLfromPosGlobal(region_name,
- result->mGlobalPos, false);
+ //TODO*: add Surl to teleportitem or parse region name from title
+ value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
add(result->getTitle(), value);
}
result = std::find_if(result + 1, th_items.end(), boost::bind(
@@ -1043,7 +1042,9 @@ void LLLocationInputCtrl::changeLocationPresentation()
if(!mTextEntry->hasSelection() && text == mHumanReadableLocation)
{
//needs unescaped one
- mTextEntry->setText(LLAgentUI::buildSLURL(false));
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl, false);
+ mTextEntry->setText(slurl.getSLURLString());
mTextEntry->selectAll();
mMaturityButton->setVisible(FALSE);
diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp
index e3817eecc4..4e0a7594ba 100644
--- a/indra/newview/llloginhandler.cpp
+++ b/indra/newview/llloginhandler.cpp
@@ -35,13 +35,14 @@
#include "llloginhandler.h"
// viewer includes
+#include "llsecapi.h"
#include "lllogininstance.h" // to check if logged in yet
#include "llpanellogin.h" // save_password_to_disk()
#include "llstartup.h" // getStartupState()
-#include "llurlsimstring.h"
+#include "llslurl.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llviewernetwork.h" // EGridInfo
-#include "llviewerwindow.h" // getWindow()
+#include "llviewerwindow.h" // getWindow()
// library includes
#include "llmd5.h"
@@ -60,109 +61,33 @@ bool LLLoginHandler::parseDirectLogin(std::string url)
LLURI uri(url);
parse(uri.queryMap());
- if (/*mWebLoginKey.isNull() ||*/
- mFirstName.empty() ||
- mLastName.empty())
- {
- return false;
- }
- else
- {
- return true;
- }
+ // NOTE: Need to add direct login as per identity evolution
+ return true;
}
-
void LLLoginHandler::parse(const LLSD& queryMap)
{
- //mWebLoginKey = queryMap["web_login_key"].asUUID();
- mFirstName = queryMap["first_name"].asString();
- mLastName = queryMap["last_name"].asString();
- EGridInfo grid_choice = GRID_INFO_NONE;
- if (queryMap["grid"].asString() == "aditi")
- {
- grid_choice = GRID_INFO_ADITI;
- }
- else if (queryMap["grid"].asString() == "agni")
- {
- grid_choice = GRID_INFO_AGNI;
- }
- else if (queryMap["grid"].asString() == "siva")
- {
- grid_choice = GRID_INFO_SIVA;
- }
- else if (queryMap["grid"].asString() == "damballah")
- {
- grid_choice = GRID_INFO_DAMBALLAH;
- }
- else if (queryMap["grid"].asString() == "durga")
- {
- grid_choice = GRID_INFO_DURGA;
- }
- else if (queryMap["grid"].asString() == "shakti")
- {
- grid_choice = GRID_INFO_SHAKTI;
- }
- else if (queryMap["grid"].asString() == "soma")
- {
- grid_choice = GRID_INFO_SOMA;
- }
- else if (queryMap["grid"].asString() == "ganga")
- {
- grid_choice = GRID_INFO_GANGA;
- }
- else if (queryMap["grid"].asString() == "vaak")
- {
- grid_choice = GRID_INFO_VAAK;
- }
- else if (queryMap["grid"].asString() == "uma")
- {
- grid_choice = GRID_INFO_UMA;
- }
- else if (queryMap["grid"].asString() == "mohini")
- {
- grid_choice = GRID_INFO_MOHINI;
- }
- else if (queryMap["grid"].asString() == "yami")
- {
- grid_choice = GRID_INFO_YAMI;
- }
- else if (queryMap["grid"].asString() == "nandi")
+ if (queryMap.has("grid"))
{
- grid_choice = GRID_INFO_NANDI;
+ LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
}
- else if (queryMap["grid"].asString() == "mitra")
- {
- grid_choice = GRID_INFO_MITRA;
- }
- else if (queryMap["grid"].asString() == "radha")
- {
- grid_choice = GRID_INFO_RADHA;
- }
- else if (queryMap["grid"].asString() == "ravi")
- {
- grid_choice = GRID_INFO_RAVI;
- }
- else if (queryMap["grid"].asString() == "aruna")
- {
- grid_choice = GRID_INFO_ARUNA;
- }
-
- if(grid_choice != GRID_INFO_NONE)
- {
- LLViewerLogin::getInstance()->setGridChoice(grid_choice);
- }
-
+
+
std::string startLocation = queryMap["location"].asString();
-
+
if (startLocation == "specify")
{
- LLURLSimString::setString(queryMap["region"].asString());
+ LLStartUp::setStartSLURL(LLSLURL(LLGridManager::getInstance()->getGridLoginID(),
+ queryMap["region"].asString()));
}
- else if (!startLocation.empty()) // "last" or "home" or ??? (let LLURLSimString figure it out)
+ else if (startLocation == "home")
{
- LLURLSimString::setString(startLocation);
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+ }
+ else if (startLocation == "last")
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
}
}
@@ -220,40 +145,65 @@ bool LLLoginHandler::handle(const LLSD& tokens,
return true;
}
- std::string password = query_map["password"].asString();
-
- if (!password.empty())
+ if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
{
- gSavedSettings.setBOOL("RememberPassword", TRUE);
-
- if (password.substr(0,3) != "$1$")
- {
- LLMD5 pass((unsigned char*)password.c_str());
- char md5pass[33]; /* Flawfinder: ignore */
- pass.hex_digest(md5pass);
- std::string hashed_password = ll_safe_string(md5pass, 32);
- LLStartUp::savePasswordToDisk(hashed_password);
- }
+ // as the login page may change from grid to grid, as well as
+ // things like username/password/etc, we simply refresh the
+ // login page to make sure everything is set up correctly
+ LLPanelLogin::loadLoginPage();
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
}
-
+ return true;
+}
- if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
- {
- if (!mFirstName.empty() || !mLastName.empty())
- {
- // Fill in the name, and maybe the password
- LLPanelLogin::setFields(mFirstName, mLastName, password);
- }
- //if (mWebLoginKey.isNull())
- //{
- // LLPanelLogin::loadLoginPage();
- //}
- //else
- //{
- // LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
- //}
- LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
- }
- return true;
+
+// Initialize the credentials
+// If the passed in URL contains login info, parse
+// that into a credential and web login key. Otherwise
+// check the command line. If the command line
+// does not contain any login creds, load the last saved
+// ones from the protected credential store.
+// This always returns with a credential structure set in the
+// login handler
+LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo()
+{
+ LLPointer<LLCredential> result = NULL;
+ // so try to load it from the UserLoginInfo
+ result = loadSavedUserLoginInfo();
+ if (result.isNull())
+ {
+ result = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
+ }
+
+ return result;
+}
+
+
+LLPointer<LLCredential> LLLoginHandler::loadSavedUserLoginInfo()
+{
+ // load the saved user login info into a LLCredential.
+ // perhaps this should be moved.
+ LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
+ if (cmd_line_login.size() == 3)
+ {
+
+ LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
+ char md5pass[33]; /* Flawfinder: ignore */
+ pass.hex_digest(md5pass);
+ LLSD identifier = LLSD::emptyMap();
+ identifier["type"] = "agent";
+ identifier["first_name"] = cmd_line_login[0];
+ identifier["last_name"] = cmd_line_login[1];
+
+ LLSD authenticator = LLSD::emptyMap();
+ authenticator["type"] = "hash";
+ authenticator["algorithm"] = "md5";
+ authenticator["secret"] = md5pass;
+ // yuck, we'll fix this with mani's changes.
+ gSavedSettings.setBOOL("AutoLogin", TRUE);
+ return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(),
+ identifier, authenticator);
+ }
+ return NULL;
}
diff --git a/indra/newview/llloginhandler.h b/indra/newview/llloginhandler.h
index ac4648761b..c15b998c91 100644
--- a/indra/newview/llloginhandler.h
+++ b/indra/newview/llloginhandler.h
@@ -34,6 +34,7 @@
#define LLLOGINHANDLER_H
#include "llcommandhandler.h"
+#include "llsecapi.h"
class LLLoginHandler : public LLCommandHandler
{
@@ -46,19 +47,15 @@ class LLLoginHandler : public LLCommandHandler
// secondlife:///app/login?first=Bob&last=Dobbs
bool parseDirectLogin(std::string url);
- std::string getFirstName() const { return mFirstName; }
- std::string getLastName() const { return mLastName; }
-
// Web-based login unsupported
//LLUUID getWebLoginKey() const { return mWebLoginKey; }
+ LLPointer<LLCredential> loadSavedUserLoginInfo();
+ LLPointer<LLCredential> initializeLoginInfo();
+
private:
void parse(const LLSD& queryMap);
-private:
- std::string mFirstName;
- std::string mLastName;
- //LLUUID mWebLoginKey;
};
extern LLLoginHandler gLoginHandler;
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 454fd29fdc..71604291e1 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -48,13 +48,16 @@
// newview
#include "llviewernetwork.h"
#include "llviewercontrol.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
+#include "llstartup.h"
#include "llfloaterreg.h"
#include "llnotifications.h"
#include "llwindow.h"
#if LL_LINUX || LL_SOLARIS
#include "lltrans.h"
#endif
+#include "llsecapi.h"
+#include "llstartup.h"
static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback";
static const char * const TOS_LISTENER_NAME = "lllogininstance_tos";
@@ -83,14 +86,14 @@ LLLoginInstance::~LLLoginInstance()
{
}
-void LLLoginInstance::connect(const LLSD& credentials)
+void LLLoginInstance::connect(LLPointer<LLCredential> credentials)
{
std::vector<std::string> uris;
- LLViewerLogin::getInstance()->getLoginURIs(uris);
+ LLGridManager::getInstance()->getLoginURIs(uris);
connect(uris.front(), credentials);
}
-void LLLoginInstance::connect(const std::string& uri, const LLSD& credentials)
+void LLLoginInstance::connect(const std::string& uri, LLPointer<LLCredential> credentials)
{
mAttemptComplete = false; // Reset attempt complete at this point!
constructAuthParams(credentials);
@@ -102,7 +105,7 @@ void LLLoginInstance::reconnect()
// Sort of like connect, only using the pre-existing
// request params.
std::vector<std::string> uris;
- LLViewerLogin::getInstance()->getLoginURIs(uris);
+ LLGridManager::getInstance()->getLoginURIs(uris);
mLoginModule->connect(uris.front(), mRequestData);
}
@@ -118,7 +121,7 @@ LLSD LLLoginInstance::getResponse()
return mResponseData;
}
-void LLLoginInstance::constructAuthParams(const LLSD& credentials)
+void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credential)
{
// Set up auth request options.
//#define LL_MINIMIAL_REQUESTED_OPTIONS
@@ -145,8 +148,11 @@ void LLLoginInstance::constructAuthParams(const LLSD& credentials)
requested_options.append("adult_compliant");
//requested_options.append("inventory-targets");
requested_options.append("buddy-list");
+ requested_options.append("newuser-config");
requested_options.append("ui-config");
#endif
+ requested_options.append("map-server-url");
+ requested_options.append("voice-config");
requested_options.append("tutorial_setting");
requested_options.append("login-flags");
requested_options.append("global-textures");
@@ -155,20 +161,18 @@ void LLLoginInstance::constructAuthParams(const LLSD& credentials)
gSavedSettings.setBOOL("UseDebugMenus", TRUE);
requested_options.append("god-connect");
}
+
+ // (re)initialize the request params with creds.
+ LLSD request_params = user_credential->getLoginParams();
char hashed_mac_string[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
LLMD5 hashed_mac;
- hashed_mac.update( gMACAddress, MAC_ADDRESS_BYTES );
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
+ hashed_mac.update( MACAddress, MAC_ADDRESS_BYTES );
hashed_mac.finalize();
hashed_mac.hex_digest(hashed_mac_string);
-
- // prepend "$1$" to the password to indicate its the md5'd version.
- std::string dpasswd("$1$");
- dpasswd.append(credentials["passwd"].asString());
-
- // (re)initialize the request params with creds.
- LLSD request_params(credentials);
- request_params["passwd"] = dpasswd;
+
request_params["start"] = construct_start_string();
request_params["skipoptional"] = mSkipOptionalUpdate;
request_params["agree_to_tos"] = false; // Always false here. Set true in
@@ -247,6 +251,15 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
LLSD data(LLSD::emptyMap());
data["message"] = message_response;
data["reply_pump"] = TOS_REPLY_PUMP;
+ if(response.has("error_code"))
+ {
+ data["error_code"] = response["error_code"];
+ }
+ if(response.has("certificate"))
+ {
+ data["certificate"] = response["certificate"];
+ }
+
LLFloaterReg::showInstance("message_critical", data);
LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
.listen(TOS_LISTENER_NAME,
@@ -452,20 +465,31 @@ bool LLLoginInstance::updateDialogCallback(const LLSD& notification, const LLSD&
std::string construct_start_string()
{
std::string start;
- if (LLURLSimString::parse())
+ LLSLURL start_slurl = LLStartUp::getStartSLURL();
+ switch(start_slurl.getType())
{
- // a startup URL was specified
- std::string unescaped_start =
+ case LLSLURL::LOCATION:
+ {
+ // a startup URL was specified
+ LLVector3 position = start_slurl.getPosition();
+ std::string unescaped_start =
STRINGIZE( "uri:"
- << LLURLSimString::sInstance.mSimName << "&"
- << LLURLSimString::sInstance.mX << "&"
- << LLURLSimString::sInstance.mY << "&"
- << LLURLSimString::sInstance.mZ);
- start = xml_escape_string(unescaped_start);
- }
- else
- {
- start = gSavedSettings.getString("LoginLocation");
+ << start_slurl.getRegion() << "&"
+ << position[VX] << "&"
+ << position[VY] << "&"
+ << position[VZ]);
+ start = xml_escape_string(unescaped_start);
+ break;
+ }
+ case LLSLURL::HOME_LOCATION:
+ {
+ start = "home";
+ break;
+ }
+ default:
+ {
+ start = "last";
+ }
}
return start;
}
diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h
index c8704eddb4..44271bb75e 100644
--- a/indra/newview/lllogininstance.h
+++ b/indra/newview/lllogininstance.h
@@ -36,6 +36,7 @@
#include "lleventdispatcher.h"
#include <boost/scoped_ptr.hpp>
#include <boost/function.hpp>
+#include "llsecapi.h"
class LLLogin;
class LLEventStream;
class LLNotificationsInterface;
@@ -48,8 +49,8 @@ public:
LLLoginInstance();
~LLLoginInstance();
- void connect(const LLSD& credential); // Connect to the current grid choice.
- void connect(const std::string& uri, const LLSD& credential); // Connect to the given uri.
+ void connect(LLPointer<LLCredential> credentials); // Connect to the current grid choice.
+ void connect(const std::string& uri, LLPointer<LLCredential> credentials); // Connect to the given uri.
void reconnect(); // reconnect using the current credentials.
void disconnect();
@@ -81,7 +82,7 @@ public:
void setUpdaterLauncher(const UpdaterLauncherCallback& ulc) { mUpdaterLauncher = ulc; }
private:
- void constructAuthParams(const LLSD& credentials);
+ void constructAuthParams(LLPointer<LLCredential> user_credentials);
void updateApp(bool mandatory, const std::string& message);
bool updateDialogCallback(const LLSD& notification, const LLSD& response);
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 2f22512aba..afca9daa67 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -91,12 +91,20 @@ BOOL LLFloaterMove::postBuild()
LLDockableFloater::postBuild();
+ // Code that implements floater buttons toggling when user moves via keyboard is located in LLAgent::propagate()
+
mForwardButton = getChild<LLJoystickAgentTurn>("forward btn");
mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn");
mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mSlideLeftButton = getChild<LLJoystickAgentSlide>("move left btn");
+ mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+
+ mSlideRightButton = getChild<LLJoystickAgentSlide>("move right btn");
+ mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+
mTurnLeftButton = getChild<LLButton>("turn left btn");
mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
mTurnLeftButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnLeft, this));
@@ -125,8 +133,6 @@ BOOL LLFloaterMove::postBuild()
btn = getChild<LLButton>("mode_fly_btn");
btn->setCommitCallback(boost::bind(&LLFloaterMove::onFlyButtonClick, this));
- showFlyControls(false);
-
initModeTooltips();
initModeButtonMap();
@@ -345,33 +351,38 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode)
void LLFloaterMove::updateButtonsWithMovementMode(const EMovementMode newMode)
{
- showFlyControls(MM_FLY == newMode);
setModeTooltip(newMode);
setModeButtonToggleState(newMode);
setModeTitle(newMode);
}
-void LLFloaterMove::showFlyControls(bool bShow)
-{
- mMoveUpButton->setVisible(bShow);
- mMoveDownButton->setVisible(bShow);
-}
-
void LLFloaterMove::initModeTooltips()
{
control_tooltip_map_t walkTipMap;
walkTipMap.insert(std::make_pair(mForwardButton, getString("walk_forward_tooltip")));
walkTipMap.insert(std::make_pair(mBackwardButton, getString("walk_back_tooltip")));
+ walkTipMap.insert(std::make_pair(mSlideLeftButton, getString("walk_left_tooltip")));
+ walkTipMap.insert(std::make_pair(mSlideRightButton, getString("walk_right_tooltip")));
+ walkTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
+ walkTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
mModeControlTooltipsMap[MM_WALK] = walkTipMap;
control_tooltip_map_t runTipMap;
runTipMap.insert(std::make_pair(mForwardButton, getString("run_forward_tooltip")));
runTipMap.insert(std::make_pair(mBackwardButton, getString("run_back_tooltip")));
+ runTipMap.insert(std::make_pair(mSlideLeftButton, getString("run_left_tooltip")));
+ runTipMap.insert(std::make_pair(mSlideRightButton, getString("run_right_tooltip")));
+ runTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
+ runTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
mModeControlTooltipsMap[MM_RUN] = runTipMap;
control_tooltip_map_t flyTipMap;
flyTipMap.insert(std::make_pair(mForwardButton, getString("fly_forward_tooltip")));
flyTipMap.insert(std::make_pair(mBackwardButton, getString("fly_back_tooltip")));
+ flyTipMap.insert(std::make_pair(mSlideLeftButton, getString("fly_left_tooltip")));
+ flyTipMap.insert(std::make_pair(mSlideRightButton, getString("fly_right_tooltip")));
+ flyTipMap.insert(std::make_pair(mMoveUpButton, getString("fly_up_tooltip")));
+ flyTipMap.insert(std::make_pair(mMoveDownButton, getString("fly_down_tooltip")));
mModeControlTooltipsMap[MM_FLY] = flyTipMap;
setModeTooltip(MM_WALK);
diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h
index dcca8308d9..fcf643f050 100644
--- a/indra/newview/llmoveview.h
+++ b/indra/newview/llmoveview.h
@@ -88,7 +88,6 @@ private:
void onFlyButtonClick();
void initMovementMode();
void setMovementMode(const EMovementMode mode);
- void showFlyControls(bool bShow);
void initModeTooltips();
void setModeTooltip(const EMovementMode mode);
void setModeTitle(const EMovementMode mode);
@@ -102,6 +101,8 @@ public:
LLJoystickAgentTurn* mForwardButton;
LLJoystickAgentTurn* mBackwardButton;
+ LLJoystickAgentSlide* mSlideLeftButton;
+ LLJoystickAgentSlide* mSlideRightButton;
LLButton* mTurnLeftButton;
LLButton* mTurnRightButton;
LLButton* mMoveUpButton;
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 0341f2c693..251c60b5bf 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -52,7 +52,6 @@
#include "llsearchcombobox.h"
#include "llsidetray.h"
#include "llslurl.h"
-#include "llurlsimstring.h"
#include "llurlregistry.h"
#include "llurldispatcher.h"
#include "llviewerinventory.h"
@@ -507,29 +506,34 @@ void LLNavigationBar::onLocationSelection()
std::string region_name;
LLVector3 local_coords(128, 128, 0);
- S32 x = 0, y = 0, z = 0;
// Is the typed location a SLURL?
- if (LLSLURL::isSLURL(typed_location))
+ LLSLURL slurl = LLSLURL(typed_location);
+ if (slurl.getType() == LLSLURL::LOCATION)
{
- // Yes. Extract region name and local coordinates from it.
- if (LLURLSimString::parse(LLSLURL::stripProtocol(typed_location), &region_name, &x, &y, &z))
- local_coords.set(x, y, z);
- else
- return;
+ region_name = slurl.getRegion();
+ local_coords = slurl.getPosition();
}
- // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too
- //but we need to know whether typed_location is a simple http url.
- else if (LLUrlRegistry::instance().isUrl(typed_location))
+ else if(!slurl.isValid())
{
+ // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too
+ // but we need to know whether typed_location is a simple http url.
+ if (LLUrlRegistry::instance().isUrl(typed_location))
+ {
// display http:// URLs in the media browser, or
// anything else is sent to the search floater
LLWeb::loadURL(typed_location);
return;
+ }
+ else
+ {
+ // assume that an user has typed the {region name} or possible {region_name, parcel}
+ region_name = typed_location.substr(0,typed_location.find(','));
+ }
}
else
{
- // assume that an user has typed the {region name} or possible {region_name, parcel}
- region_name = typed_location.substr(0,typed_location.find(','));
+ // was an app slurl, home, whatever. Bail
+ return;
}
// Resolve the region name to its global coordinates.
@@ -561,7 +565,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
*/
LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
gAgent.getPosAgentFromGlobal(global_agent_pos));
- std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false));
+ std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
LLLocationHistoryItem item (location,
global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
@@ -650,7 +654,7 @@ void LLNavigationBar::onRegionNameResponse(
LLVector3d region_pos = from_region_handle(region_handle);
LLVector3d global_pos = region_pos + (LLVector3d) local_coords;
- llinfos << "Teleporting to: " << LLSLURL::buildSLURLfromPosGlobal(region_name, global_pos, false) << llendl;
+ llinfos << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << llendl;
gAgent.teleportViaLocation(global_pos);
}
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 3f551f6b32..95b946f307 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -114,8 +114,7 @@ void LLSysHandler::removeExclusiveNotifications(const LLNotificationPtr& notif)
const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
REVOKED_MODIFY_RIGHTS("RevokedModifyRights"), OBJECT_GIVE_ITEM(
- "ObjectGiveItem"), OBJECT_GIVE_ITEM_UNKNOWN_USER(
- "ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"),
+ "ObjectGiveItem"), PAYMENT_RECIVED("PaymentRecived"),
ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"),
USER_GIVE_ITEM("UserGiveItem"),
INVENTORY_ACCEPTED("InventoryAccepted"),
@@ -327,8 +326,7 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi
"SESSION_NAME") ? notification->getPayload()["SESSION_NAME"].asString() : name;
// don't create IM p2p session with objects, it's necessary condition to log
- if (notification->getName() != OBJECT_GIVE_ITEM && notification->getName()
- != OBJECT_GIVE_ITEM_UNKNOWN_USER)
+ if (notification->getName() != OBJECT_GIVE_ITEM)
{
LLUUID from_id = notification->getPayload()["from_id"];
diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp
index 316ff4324c..20b40b4e1d 100644
--- a/indra/newview/llnotificationstorage.cpp
+++ b/indra/newview/llnotificationstorage.cpp
@@ -112,8 +112,8 @@ void LLPersistentNotificationStorage::saveNotifications()
LLNotificationPtr notification = *it;
// After a notification was placed in Persist channel, it can become
- // responded, expired - in this case we are should not save it
- if(notification->isRespondedTo()
+ // responded, expired or canceled - in this case we are should not save it
+ if(notification->isRespondedTo() || notification->isCancelled()
|| notification->isExpired())
{
continue;
@@ -208,7 +208,6 @@ LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std
build_map_t::const_iterator it = sBuildMap.find(notification_name);
if(sBuildMap.end() == it)
{
- llwarns << "Responder for notification \'" << notification_name << "\' is not registered" << llendl;
return NULL;
}
responder_constructor_t ctr = it->second;
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 18bd610dd9..12d5203429 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -169,6 +169,9 @@ void LLOutfitsList::refreshList(const LLUUID& category_id)
// Setting list commit callback to monitor currently selected wearable item.
list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1));
+ // Setting list refresh callback to apply filter on list change.
+ list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onWearableItemsListRefresh, this, _1));
+
// Fetch the new outfit contents.
cat->fetch();
@@ -244,35 +247,9 @@ void LLOutfitsList::performAction(std::string action)
void LLOutfitsList::setFilterSubString(const std::string& string)
{
- mFilterSubString = string;
+ applyFilter(string);
- for (outfits_map_t::iterator
- iter = mOutfitsMap.begin(),
- iter_end = mOutfitsMap.end();
- iter != iter_end; ++iter)
- {
- LLAccordionCtrlTab* tab = iter->second;
- if (tab)
- {
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*> (tab->getAccordionView());
- if (list)
- {
- list->setFilterSubString(mFilterSubString);
- }
-
- if(!mFilterSubString.empty())
- {
- //store accordion tab state when filter is not empty
- tab->notifyChildren(LLSD().with("action","store_state"));
- tab->setDisplayChildren(true);
- }
- else
- {
- //restore accordion state after all those accodrion tab manipulations
- tab->notifyChildren(LLSD().with("action","restore_state"));
- }
- }
- }
+ mFilterSubString = string;
}
//////////////////////////////////////////////////////////////////////////
@@ -350,4 +327,102 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI
mSelectedOutfitUUID = category_id;
}
+void LLOutfitsList::onWearableItemsListRefresh(LLUICtrl* ctrl)
+{
+ if (!ctrl || mFilterSubString.empty())
+ return;
+
+ for (outfits_map_t::iterator
+ iter = mOutfitsMap.begin(),
+ iter_end = mOutfitsMap.end();
+ iter != iter_end; ++iter)
+ {
+ LLAccordionCtrlTab* tab = iter->second;
+ if (tab) continue;
+
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (list != ctrl) continue;
+
+ std::string title = tab->getTitle();
+ LLStringUtil::toUpper(title);
+
+ std::string cur_filter = mFilterSubString;
+ LLStringUtil::toUpper(cur_filter);
+
+ if (std::string::npos == title.find(cur_filter))
+ {
+ // hide tab if its title doesn't pass filter
+ // and it has no visible items
+ tab->setVisible(list->size() != 0);
+ }
+ else
+ {
+ tab->setTitle(tab->getTitle(), cur_filter);
+ }
+ }
+}
+
+void LLOutfitsList::applyFilter(const std::string& new_filter_substring)
+{
+ for (outfits_map_t::iterator
+ iter = mOutfitsMap.begin(),
+ iter_end = mOutfitsMap.end();
+ iter != iter_end; ++iter)
+ {
+ LLAccordionCtrlTab* tab = iter->second;
+ if (!tab) continue;
+
+ bool more_restrictive = mFilterSubString.size() < new_filter_substring.size() && !new_filter_substring.substr(0, mFilterSubString.size()).compare(mFilterSubString);
+
+ // Restore tab visibility in case of less restrictive filter
+ // to compare it with updated string if it was previously hidden.
+ if (!more_restrictive)
+ {
+ tab->setVisible(TRUE);
+ }
+
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (list)
+ {
+ list->setFilterSubString(new_filter_substring);
+ }
+
+ if(mFilterSubString.empty() && !new_filter_substring.empty())
+ {
+ //store accordion tab state when filter is not empty
+ tab->notifyChildren(LLSD().with("action","store_state"));
+ }
+
+ if (!new_filter_substring.empty())
+ {
+ tab->setDisplayChildren(true);
+
+ std::string title = tab->getTitle();
+ LLStringUtil::toUpper(title);
+
+ std::string cur_filter = new_filter_substring;
+ LLStringUtil::toUpper(cur_filter);
+
+ if (std::string::npos == title.find(cur_filter))
+ {
+ // hide tab if its title doesn't pass filter
+ // and it has no visible items
+ tab->setVisible(list->size() != 0);
+ }
+ else
+ {
+ tab->setTitle(tab->getTitle(), cur_filter);
+ }
+ }
+ else
+ {
+ // restore tab title when filter is empty
+ tab->setTitle(tab->getTitle());
+
+ //restore accordion state after all those accodrion tab manipulations
+ tab->notifyChildren(LLSD().with("action","restore_state"));
+ }
+ }
+}
+
// EOF
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index d86cf5a703..bcb393b12a 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -94,6 +94,17 @@ private:
*/
void changeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id);
+ /**
+ * Called upon list refresh event to update tab visibility depending on
+ * the results of applying filter to the title and list items of the tab.
+ */
+ void onWearableItemsListRefresh(LLUICtrl* ctrl);
+
+ /**
+ * Highlights filtered items and hides tabs which haven't passed filter.
+ */
+ void applyFilter(const std::string& new_filter_substring);
+
LLInventoryCategoriesObserver* mCategoriesObserver;
LLAccordionCtrl* mAccordion;
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index d6d48a4ead..197a0ef728 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -142,7 +142,7 @@ void LLOutputMonitorCtrl::draw()
// Copied from llmediaremotectrl.cpp
// *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
- // call directly into gVoiceClient to ask if that agent-id is muted, is
+ // call directly into LLVoiceClient::getInstance() to ask if that agent-id is muted, is
// speaking, and what power. This avoids duplicating data, which can get
// out of sync.
const F32 LEVEL_0 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL / 3.f;
@@ -151,14 +151,14 @@ void LLOutputMonitorCtrl::draw()
if (getVisible() && mAutoUpdate && !mIsMuted && mSpeakerId.notNull())
{
- setPower(gVoiceClient->getCurrentPower(mSpeakerId));
+ setPower(LLVoiceClient::getInstance()->getCurrentPower(mSpeakerId));
if(mIsAgentControl)
{
- setIsTalking(gVoiceClient->getUserPTTState());
+ setIsTalking(LLVoiceClient::getInstance()->getUserPTTState());
}
else
{
- setIsTalking(gVoiceClient->getIsSpeaking(mSpeakerId));
+ setIsTalking(LLVoiceClient::getInstance()->getIsSpeaking(mSpeakerId));
}
}
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index b7454a5066..3a83da67e2 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -143,7 +143,7 @@ private:
LLPointer<LLUIImage> mImageLevel2;
LLPointer<LLUIImage> mImageLevel3;
- /** whether to deal with gVoiceClient directly */
+ /** whether to deal with LLVoiceClient::getInstance() directly */
bool mAutoUpdate;
/** uuid of a speaker being monitored */
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
index 67e048885f..3f1b23ba14 100644
--- a/indra/newview/lloverlaybar.cpp
+++ b/indra/newview/lloverlaybar.cpp
@@ -258,7 +258,7 @@ void LLOverlayBar::refresh()
{
// update "remotes"
childSetVisible("media_remote_container", TRUE);
- childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled());
+ childSetVisible("voice_remote_container", LLVoiceClient::getInstance()->voiceEnabled());
childSetVisible("state_buttons", TRUE);
}
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index dd632ccefe..0b31ffc9a0 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -164,7 +164,7 @@ BOOL LLPanelAvatarNotes::postBuild()
resetControls();
resetData();
- gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
+ LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
return TRUE;
}
@@ -375,7 +375,7 @@ void LLPanelAvatarNotes::onChange(EStatusType status, const std::string &channel
return;
}
- childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
+ childSetEnabled("call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
}
void LLPanelAvatarNotes::setAvatarId(const LLUUID& id)
@@ -519,7 +519,7 @@ BOOL LLPanelAvatarProfile::postBuild()
pic = getChild<LLTextureCtrl>("real_world_pic");
pic->setFallbackImageName("default_profile_picture.j2c");
- gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
+ LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
resetControls();
resetData();
@@ -814,7 +814,7 @@ void LLPanelAvatarProfile::onChange(EStatusType status, const std::string &chann
return;
}
- childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
+ childSetEnabled("call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
}
void LLPanelAvatarProfile::setAvatarId(const LLUUID& id)
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 3c112b8b5e..557fb399be 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -115,7 +115,7 @@ public:
public:
struct WearableEntry : public LLDictionaryEntry
{
- WearableEntry(EWearableType type,
+ WearableEntry(LLWearableType::EType type,
const std::string &title,
const std::string &desc_title,
U8 num_color_swatches, // number of 'color_swatches'
@@ -123,7 +123,7 @@ public:
U8 num_subparts, ... ); // number of subparts followed by a list of ETextureIndex and ESubparts
- const EWearableType mWearableType;
+ const LLWearableType::EType mWearableType;
const std::string mTitle;
const std::string mDescTitle;
subpart_vec_t mSubparts;
@@ -131,12 +131,12 @@ public:
texture_vec_t mTextureCtrls;
};
- struct Wearables : public LLDictionary<EWearableType, WearableEntry>
+ struct Wearables : public LLDictionary<LLWearableType::EType, WearableEntry>
{
Wearables();
} mWearables;
- const WearableEntry* getWearable(EWearableType type) const { return mWearables.lookup(type); }
+ const WearableEntry* getWearable(LLWearableType::EType type) const { return mWearables.lookup(type); }
//--------------------------------------------------------------------
// Subparts
@@ -212,24 +212,24 @@ LLEditWearableDictionary::~LLEditWearableDictionary()
LLEditWearableDictionary::Wearables::Wearables()
{
- addEntry(WT_SHAPE, new WearableEntry(WT_SHAPE,"edit_shape_title","shape_desc_text",0,0,9, SUBPART_SHAPE_HEAD, SUBPART_SHAPE_EYES, SUBPART_SHAPE_EARS, SUBPART_SHAPE_NOSE, SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS, SUBPART_SHAPE_WHOLE));
- addEntry(WT_SKIN, new WearableEntry(WT_SKIN,"edit_skin_title","skin_desc_text",0,3,4, TEX_HEAD_BODYPAINT, TEX_UPPER_BODYPAINT, TEX_LOWER_BODYPAINT, SUBPART_SKIN_COLOR, SUBPART_SKIN_FACEDETAIL, SUBPART_SKIN_MAKEUP, SUBPART_SKIN_BODYDETAIL));
- addEntry(WT_HAIR, new WearableEntry(WT_HAIR,"edit_hair_title","hair_desc_text",0,1,4, TEX_HAIR, SUBPART_HAIR_COLOR, SUBPART_HAIR_STYLE, SUBPART_HAIR_EYEBROWS, SUBPART_HAIR_FACIAL));
- addEntry(WT_EYES, new WearableEntry(WT_EYES,"edit_eyes_title","eyes_desc_text",0,1,1, TEX_EYES_IRIS, SUBPART_EYES));
- addEntry(WT_SHIRT, new WearableEntry(WT_SHIRT,"edit_shirt_title","shirt_desc_text",1,1,1, TEX_UPPER_SHIRT, TEX_UPPER_SHIRT, SUBPART_SHIRT));
- addEntry(WT_PANTS, new WearableEntry(WT_PANTS,"edit_pants_title","pants_desc_text",1,1,1, TEX_LOWER_PANTS, TEX_LOWER_PANTS, SUBPART_PANTS));
- addEntry(WT_SHOES, new WearableEntry(WT_SHOES,"edit_shoes_title","shoes_desc_text",1,1,1, TEX_LOWER_SHOES, TEX_LOWER_SHOES, SUBPART_SHOES));
- addEntry(WT_SOCKS, new WearableEntry(WT_SOCKS,"edit_socks_title","socks_desc_text",1,1,1, TEX_LOWER_SOCKS, TEX_LOWER_SOCKS, SUBPART_SOCKS));
- addEntry(WT_JACKET, new WearableEntry(WT_JACKET,"edit_jacket_title","jacket_desc_text",1,2,1, TEX_UPPER_JACKET, TEX_UPPER_JACKET, TEX_LOWER_JACKET, SUBPART_JACKET));
- addEntry(WT_GLOVES, new WearableEntry(WT_GLOVES,"edit_gloves_title","gloves_desc_text",1,1,1, TEX_UPPER_GLOVES, TEX_UPPER_GLOVES, SUBPART_GLOVES));
- addEntry(WT_UNDERSHIRT, new WearableEntry(WT_UNDERSHIRT,"edit_undershirt_title","undershirt_desc_text",1,1,1, TEX_UPPER_UNDERSHIRT, TEX_UPPER_UNDERSHIRT, SUBPART_UNDERSHIRT));
- addEntry(WT_UNDERPANTS, new WearableEntry(WT_UNDERPANTS,"edit_underpants_title","underpants_desc_text",1,1,1, TEX_LOWER_UNDERPANTS, TEX_LOWER_UNDERPANTS, SUBPART_UNDERPANTS));
- addEntry(WT_SKIRT, new WearableEntry(WT_SKIRT,"edit_skirt_title","skirt_desc_text",1,1,1, TEX_SKIRT, TEX_SKIRT, SUBPART_SKIRT));
- addEntry(WT_ALPHA, new WearableEntry(WT_ALPHA,"edit_alpha_title","alpha_desc_text",0,5,1, TEX_LOWER_ALPHA, TEX_UPPER_ALPHA, TEX_HEAD_ALPHA, TEX_EYES_ALPHA, TEX_HAIR_ALPHA, SUBPART_ALPHA));
- addEntry(WT_TATTOO, new WearableEntry(WT_TATTOO,"edit_tattoo_title","tattoo_desc_text",0,3,1, TEX_LOWER_TATTOO, TEX_UPPER_TATTOO, TEX_HEAD_TATTOO, SUBPART_TATTOO));
+ addEntry(LLWearableType::WT_SHAPE, new WearableEntry(LLWearableType::WT_SHAPE,"edit_shape_title","shape_desc_text",0,0,9, SUBPART_SHAPE_HEAD, SUBPART_SHAPE_EYES, SUBPART_SHAPE_EARS, SUBPART_SHAPE_NOSE, SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS, SUBPART_SHAPE_WHOLE));
+ addEntry(LLWearableType::WT_SKIN, new WearableEntry(LLWearableType::WT_SKIN,"edit_skin_title","skin_desc_text",0,3,4, TEX_HEAD_BODYPAINT, TEX_UPPER_BODYPAINT, TEX_LOWER_BODYPAINT, SUBPART_SKIN_COLOR, SUBPART_SKIN_FACEDETAIL, SUBPART_SKIN_MAKEUP, SUBPART_SKIN_BODYDETAIL));
+ addEntry(LLWearableType::WT_HAIR, new WearableEntry(LLWearableType::WT_HAIR,"edit_hair_title","hair_desc_text",0,1,4, TEX_HAIR, SUBPART_HAIR_COLOR, SUBPART_HAIR_STYLE, SUBPART_HAIR_EYEBROWS, SUBPART_HAIR_FACIAL));
+ addEntry(LLWearableType::WT_EYES, new WearableEntry(LLWearableType::WT_EYES,"edit_eyes_title","eyes_desc_text",0,1,1, TEX_EYES_IRIS, SUBPART_EYES));
+ addEntry(LLWearableType::WT_SHIRT, new WearableEntry(LLWearableType::WT_SHIRT,"edit_shirt_title","shirt_desc_text",1,1,1, TEX_UPPER_SHIRT, TEX_UPPER_SHIRT, SUBPART_SHIRT));
+ addEntry(LLWearableType::WT_PANTS, new WearableEntry(LLWearableType::WT_PANTS,"edit_pants_title","pants_desc_text",1,1,1, TEX_LOWER_PANTS, TEX_LOWER_PANTS, SUBPART_PANTS));
+ addEntry(LLWearableType::WT_SHOES, new WearableEntry(LLWearableType::WT_SHOES,"edit_shoes_title","shoes_desc_text",1,1,1, TEX_LOWER_SHOES, TEX_LOWER_SHOES, SUBPART_SHOES));
+ addEntry(LLWearableType::WT_SOCKS, new WearableEntry(LLWearableType::WT_SOCKS,"edit_socks_title","socks_desc_text",1,1,1, TEX_LOWER_SOCKS, TEX_LOWER_SOCKS, SUBPART_SOCKS));
+ addEntry(LLWearableType::WT_JACKET, new WearableEntry(LLWearableType::WT_JACKET,"edit_jacket_title","jacket_desc_text",1,2,1, TEX_UPPER_JACKET, TEX_UPPER_JACKET, TEX_LOWER_JACKET, SUBPART_JACKET));
+ addEntry(LLWearableType::WT_GLOVES, new WearableEntry(LLWearableType::WT_GLOVES,"edit_gloves_title","gloves_desc_text",1,1,1, TEX_UPPER_GLOVES, TEX_UPPER_GLOVES, SUBPART_GLOVES));
+ addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(LLWearableType::WT_UNDERSHIRT,"edit_undershirt_title","undershirt_desc_text",1,1,1, TEX_UPPER_UNDERSHIRT, TEX_UPPER_UNDERSHIRT, SUBPART_UNDERSHIRT));
+ addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(LLWearableType::WT_UNDERPANTS,"edit_underpants_title","underpants_desc_text",1,1,1, TEX_LOWER_UNDERPANTS, TEX_LOWER_UNDERPANTS, SUBPART_UNDERPANTS));
+ addEntry(LLWearableType::WT_SKIRT, new WearableEntry(LLWearableType::WT_SKIRT,"edit_skirt_title","skirt_desc_text",1,1,1, TEX_SKIRT, TEX_SKIRT, SUBPART_SKIRT));
+ addEntry(LLWearableType::WT_ALPHA, new WearableEntry(LLWearableType::WT_ALPHA,"edit_alpha_title","alpha_desc_text",0,5,1, TEX_LOWER_ALPHA, TEX_UPPER_ALPHA, TEX_HEAD_ALPHA, TEX_EYES_ALPHA, TEX_HAIR_ALPHA, SUBPART_ALPHA));
+ addEntry(LLWearableType::WT_TATTOO, new WearableEntry(LLWearableType::WT_TATTOO,"edit_tattoo_title","tattoo_desc_text",0,3,1, TEX_LOWER_TATTOO, TEX_UPPER_TATTOO, TEX_HEAD_TATTOO, SUBPART_TATTOO));
}
-LLEditWearableDictionary::WearableEntry::WearableEntry(EWearableType type,
+LLEditWearableDictionary::WearableEntry::WearableEntry(LLWearableType::EType type,
const std::string &title,
const std::string &desc_title,
U8 num_color_swatches,
@@ -442,7 +442,7 @@ get_picker_entry<LLTextureCtrl> (const ETextureIndex index)
template <typename CtrlType, class Predicate>
const LLEditWearableDictionary::PickerControlEntry*
-find_picker_ctrl_entry_if(EWearableType type, const Predicate pred)
+find_picker_ctrl_entry_if(LLWearableType::EType type, const Predicate pred)
{
const LLEditWearableDictionary::WearableEntry *wearable_entry
= LLEditWearableDictionary::getInstance()->getWearable(type);
@@ -475,7 +475,7 @@ find_picker_ctrl_entry_if(EWearableType type, const Predicate pred)
template <typename CtrlType>
void
-for_each_picker_ctrl_entry(LLPanel* panel, EWearableType type, function_t fun)
+for_each_picker_ctrl_entry(LLPanel* panel, LLWearableType::EType type, function_t fun)
{
if (!panel)
{
@@ -635,6 +635,8 @@ BOOL LLPanelEditWearable::postBuild()
mPanelAlpha = getChild<LLPanel>("edit_alpha_panel");
mPanelTattoo = getChild<LLPanel>("edit_tattoo_panel");
+ mTxtAvatarHeight = mPanelShape->getChild<LLTextBox>("avatar_height");
+
mWearablePtr = NULL;
return TRUE;
@@ -661,7 +663,9 @@ void LLPanelEditWearable::draw()
updateVerbs();
if (getWearable())
{
- updatePanelPickerControls(getWearable()->getType());
+ LLWearableType::EType type = getWearable()->getType();
+ updatePanelPickerControls(type);
+ updateTypeSpecificControls(type);
}
LLPanel::draw();
@@ -694,7 +698,7 @@ void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl)
if (getWearable())
{
- EWearableType type = getWearable()->getType();
+ LLWearableType::EType type = getWearable()->getType();
const PickerControlEntryNamePredicate name_pred(texture_ctrl->getName());
const LLEditWearableDictionary::PickerControlEntry* entry
= find_picker_ctrl_entry_if<LLTextureCtrl, PickerControlEntryNamePredicate>(type, name_pred);
@@ -725,7 +729,7 @@ void LLPanelEditWearable::onColorSwatchCommit(const LLUICtrl* ctrl)
{
if (getWearable())
{
- EWearableType type = getWearable()->getType();
+ LLWearableType::EType type = getWearable()->getType();
const PickerControlEntryNamePredicate name_pred(ctrl->getName());
const LLEditWearableDictionary::PickerControlEntry* entry
= find_picker_ctrl_entry_if<LLColorSwatchCtrl, PickerControlEntryNamePredicate>(type, name_pred);
@@ -747,7 +751,7 @@ void LLPanelEditWearable::onColorSwatchCommit(const LLUICtrl* ctrl)
}
}
-void LLPanelEditWearable::updatePanelPickerControls(EWearableType type)
+void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type)
{
LLPanel* panel = getPanel(type);
if (!panel)
@@ -823,7 +827,7 @@ void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show)
mWearableItem = gInventory.getItem(mWearablePtr->getItemID());
llassert(mWearableItem);
- EWearableType type = wearable->getType();
+ LLWearableType::EType type = wearable->getType();
LLPanel *targetPanel = NULL;
std::string title;
std::string description_title;
@@ -859,11 +863,14 @@ void LLPanelEditWearable::initializePanel()
return;
}
- EWearableType type = mWearablePtr->getType();
+ LLWearableType::EType type = mWearablePtr->getType();
// set name
mTextEditor->setText(mWearablePtr->getName());
+ // toggle wearable type-specific controls
+ toggleTypeSpecificControls(type);
+
// clear and rebuild visual param list
const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
if (!wearable_entry)
@@ -922,6 +929,28 @@ void LLPanelEditWearable::initializePanel()
updateVerbs();
}
+void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type)
+{
+ // Toggle controls specific to shape editing panel.
+ {
+ bool is_shape = (type == LLWearableType::WT_SHAPE);
+ childSetVisible("sex_radio", is_shape);
+ childSetVisible("female_icon", is_shape);
+ childSetVisible("male_icon", is_shape);
+ }
+}
+
+void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
+{
+ // Update controls specific to shape editing panel.
+ if (type == LLWearableType::WT_SHAPE)
+ {
+ // Update avatar height
+ std::string avatar_height_str = llformat("%.2f", gAgentAvatarp->mBodySize.mV[VZ]);
+ mTxtAvatarHeight->setTextArg("[HEIGHT]", avatar_height_str);
+ }
+}
+
void LLPanelEditWearable::updateScrollingPanelUI()
{
// do nothing if we don't have a valid wearable we're editing
@@ -930,7 +959,7 @@ void LLPanelEditWearable::updateScrollingPanelUI()
return;
}
- EWearableType type = mWearablePtr->getType();
+ LLWearableType::EType type = mWearablePtr->getType();
LLPanel *panel = getPanel(type);
if(panel && (mWearablePtr->getItemID().notNull()))
@@ -960,67 +989,67 @@ void LLPanelEditWearable::updateScrollingPanelUI()
}
}
-LLPanel* LLPanelEditWearable::getPanel(EWearableType type)
+LLPanel* LLPanelEditWearable::getPanel(LLWearableType::EType type)
{
switch (type)
{
- case WT_SHAPE:
+ case LLWearableType::WT_SHAPE:
return mPanelShape;
break;
- case WT_SKIN:
+ case LLWearableType::WT_SKIN:
return mPanelSkin;
break;
- case WT_HAIR:
+ case LLWearableType::WT_HAIR:
return mPanelHair;
break;
- case WT_EYES:
+ case LLWearableType::WT_EYES:
return mPanelEyes;
break;
- case WT_SHIRT:
+ case LLWearableType::WT_SHIRT:
return mPanelShirt;
break;
- case WT_PANTS:
+ case LLWearableType::WT_PANTS:
return mPanelPants;
break;
- case WT_SHOES:
+ case LLWearableType::WT_SHOES:
return mPanelShoes;
break;
- case WT_SOCKS:
+ case LLWearableType::WT_SOCKS:
return mPanelSocks;
break;
- case WT_JACKET:
+ case LLWearableType::WT_JACKET:
return mPanelJacket;
break;
- case WT_GLOVES:
+ case LLWearableType::WT_GLOVES:
return mPanelGloves;
break;
- case WT_UNDERSHIRT:
+ case LLWearableType::WT_UNDERSHIRT:
return mPanelUndershirt;
break;
- case WT_UNDERPANTS:
+ case LLWearableType::WT_UNDERPANTS:
return mPanelUnderpants;
break;
- case WT_SKIRT:
+ case LLWearableType::WT_SKIRT:
return mPanelSkirt;
break;
- case WT_ALPHA:
+ case LLWearableType::WT_ALPHA:
return mPanelAlpha;
break;
- case WT_TATTOO:
+ case LLWearableType::WT_TATTOO:
return mPanelTattoo;
break;
default:
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 76b0ddb3cc..a5a332019d 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -36,7 +36,7 @@
#include "llpanel.h"
#include "llscrollingpanellist.h"
#include "llmodaldialog.h"
-#include "llwearabledictionary.h"
+#include "llwearabletype.h"
class LLWearable;
class LLTextEditor;
@@ -71,7 +71,7 @@ private:
void showWearable(LLWearable* wearable, BOOL show);
void initializePanel();
void updateScrollingPanelUI();
- LLPanel* getPanel(EWearableType type);
+ LLPanel* getPanel(LLWearableType::EType type);
void getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
void buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab);
// update bottom bar buttons ("Save", "Revert", etc)
@@ -79,7 +79,9 @@ private:
void onColorSwatchCommit(const LLUICtrl*);
void onTexturePickerCommit(const LLUICtrl*);
- void updatePanelPickerControls(EWearableType type);
+ void updatePanelPickerControls(LLWearableType::EType type);
+ void toggleTypeSpecificControls(LLWearableType::EType type);
+ void updateTypeSpecificControls(LLWearableType::EType type);
// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
LLWearable *mWearablePtr;
@@ -91,6 +93,7 @@ private:
LLTextBox *mPanelTitle;
LLTextBox *mDescTitle;
+ LLTextBox *mTxtAvatarHeight;
// This text editor reference will change each time we edit a new wearable -
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index c00b6a4147..d997b83cbb 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -92,8 +92,7 @@ LLPanelGroup::LLPanelGroup()
: LLPanel(),
LLGroupMgrObserver( LLUUID() ),
mSkipRefresh(FALSE),
- mButtonJoin(NULL),
- mShowingNotifyDialog(false)
+ mButtonJoin(NULL)
{
// Set up the factory callbacks.
// Roles sub tabs
@@ -201,7 +200,7 @@ BOOL LLPanelGroup::postBuild()
mJoinText = panel_general->getChild<LLUICtrl>("join_cost_text");
}
- gVoiceClient->addObserver(this);
+ LLVoiceClient::getInstance()->addObserver(this);
return TRUE;
}
@@ -322,7 +321,7 @@ void LLPanelGroup::onChange(EStatusType status, const std::string &channelURI, b
return;
}
- childSetEnabled("btn_call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
+ childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
}
void LLPanelGroup::notifyObservers()
@@ -629,69 +628,4 @@ void LLPanelGroup::showNotice(const std::string& subject,
}
-bool LLPanelGroup::canClose()
-{
- if(getVisible() == false)
- return true;
-
- bool need_save = false;
- std::string mesg;
- for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
- if(need_save|=(*it)->needsApply(mesg))
- break;
- if(!need_save)
- return false;
- // If no message was provided, give a generic one.
- if (mesg.empty())
- {
- mesg = mDefaultNeedsApplyMesg;
- }
- // Create a notify box, telling the user about the unapplied tab.
- LLSD args;
- args["NEEDS_APPLY_MESSAGE"] = mesg;
- args["WANT_APPLY_MESSAGE"] = mWantApplyMesg;
-
- LLNotificationsUtil::add("SaveChanges", args, LLSD(), boost::bind(&LLPanelGroup::handleNotifyCallback,this, _1, _2));
-
- mShowingNotifyDialog = true;
-
- return false;
-}
-
-bool LLPanelGroup::notifyChildren(const LLSD& info)
-{
- if(info.has("request") && mID.isNull() )
- {
- std::string str_action = info["request"];
-
- if (str_action == "quit" )
- {
- canClose();
- return true;
- }
- if(str_action == "wait_quit")
- return mShowingNotifyDialog;
- }
- return false;
-}
-bool LLPanelGroup::handleNotifyCallback(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- mShowingNotifyDialog = false;
- switch (option)
- {
- case 0: // "Apply Changes"
- apply();
- break;
- case 1: // "Ignore Changes"
- break;
- case 2: // "Cancel"
- default:
- // Do nothing. The user is canceling the action.
- // If we were quitting, we didn't really mean it.
- LLAppViewer::instance()->abortQuit();
- break;
- }
- return false;
-}
diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h
index 359f252383..13a03b0713 100644
--- a/indra/newview/llpanelgroup.h
+++ b/indra/newview/llpanelgroup.h
@@ -95,9 +95,6 @@ public:
LLOfferInfo* inventory_offer);
- bool notifyChildren (const LLSD& info);
- bool handleNotifyCallback(const LLSD&, const LLSD&);
-
protected:
virtual void update(LLGroupChange gc);
@@ -117,9 +114,6 @@ protected:
protected:
bool apply(LLPanelGroupTab* tab);
- bool canClose();
-
- bool mShowingNotifyDialog;
LLTimer mRefreshTimer;
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 0a83ba8212..ddd41a1791 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -846,6 +846,17 @@ void LLPanelGroupGeneral::reset()
mInsignia->setEnabled(true);
+ LLPointer<LLUIImage> imagep = LLUI::getUIImage(mInsignia->getDefaultImageName());
+ if(imagep)
+ {
+ LLViewerFetchedTexture* pTexture = dynamic_cast<LLViewerFetchedTexture*>(imagep->getImage().get());
+ if(pTexture)
+ {
+ LLUUID id = pTexture->getID();
+ mInsignia->setImageAssetID(id);
+ }
+ }
+
{
std::string empty_str = "";
mEditCharter->setText(empty_str);
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 230e484fad..362d8581f3 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -335,9 +335,10 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
item_is_multi = TRUE;
};
- std::string icon_name = get_item_icon_name(inv_item->getType(),
+ std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
inv_item->getInventoryType(),
inv_item->getFlags(),
+ inv_item->getIsLinkType(),
item_is_multi );
mCreateInventoryIcon->setValue(icon_name);
@@ -552,9 +553,9 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
row["columns"][0]["column"] = "icon";
if (has_attachment)
{
- std::string icon_name = get_item_icon_name(
+ std::string icon_name = LLInventoryIcon::getIconName(
(LLAssetType::EType)asset_type,
- LLInventoryType::IT_NONE,FALSE, FALSE);
+ LLInventoryType::IT_NONE);
row["columns"][0]["type"] = "icon";
row["columns"][0]["value"] = icon_name;
}
@@ -620,9 +621,8 @@ void LLPanelGroupNotices::showNotice(const std::string& subject,
{
mInventoryOffer = inventory_offer;
- std::string icon_name = get_item_icon_name(mInventoryOffer->mType,
- LLInventoryType::IT_TEXTURE,
- 0, FALSE);
+ std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
+ LLInventoryType::IT_TEXTURE);
mViewInventoryIcon->setValue(icon_name);
mViewInventoryIcon->setVisible(TRUE);
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 0c24e6ad22..a77ba0c69c 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -145,8 +145,6 @@ BOOL LLPanelGroupRoles::postBuild()
llwarns << "Invalid subtab panel: " << panel->getName() << llendl;
return FALSE;
}
- // Add click callbacks to all the tabs.
- mSubTabContainer->setCommitCallback(boost::bind(&LLPanelGroupRoles::handleClickSubTab, this));
// Hand the subtab a pointer to this LLPanelGroupRoles, so that it can
// look around for the widgets it is interested in.
@@ -155,6 +153,8 @@ BOOL LLPanelGroupRoles::postBuild()
//subtabp->addObserver(this);
}
+ // Add click callbacks to all the tabs.
+ mSubTabContainer->setCommitCallback(boost::bind(&LLPanelGroupRoles::handleClickSubTab, this));
// Set the current tab to whatever is currently being shown.
mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index c34f0633b9..709bb83fe4 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -81,7 +81,8 @@ void LLPanelChatControlPanel::onVoiceChannelStateChanged(const LLVoiceChannel::E
void LLPanelChatControlPanel::updateCallButton()
{
- bool voice_enabled = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
+ // hide/show call button
+ bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
@@ -124,7 +125,7 @@ BOOL LLPanelChatControlPanel::postBuild()
childSetAction("end_call_btn", boost::bind(&LLPanelChatControlPanel::onEndCallButtonClicked, this));
childSetAction("voice_ctrls_btn", boost::bind(&LLPanelChatControlPanel::onOpenVoiceControlsClicked, this));
- gVoiceClient->addObserver(this);
+ LLVoiceClient::getInstance()->addObserver(this);
return TRUE;
}
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 0a978d1b26..4bf4f9eac1 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -309,6 +309,25 @@ void LLLandmarksPanel::onTeleport()
}
// virtual
+bool LLLandmarksPanel::isSingleItemSelected()
+{
+ bool result = false;
+
+ if (mCurrentSelectedList != NULL)
+ {
+ LLPlacesFolderView* root_view =
+ static_cast<LLPlacesFolderView*>(mCurrentSelectedList->getRootFolder());
+
+ if (root_view->getSelectedCount() == 1)
+ {
+ result = isLandmarkSelected();
+ }
+ }
+
+ return result;
+}
+
+// virtual
void LLLandmarksPanel::updateVerbs()
{
if (!isTabVisible())
@@ -316,8 +335,8 @@ void LLLandmarksPanel::updateVerbs()
bool landmark_selected = isLandmarkSelected();
mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport"));
- mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map"));
mShowProfile->setEnabled(landmark_selected && isActionEnabled("more_info"));
+ mShowOnMapBtn->setEnabled(true);
// TODO: mantipov: Uncomment when mShareBtn is supported
// Share button should be enabled when neither a folder nor a landmark is selected
@@ -974,10 +993,13 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
}
else if("create_pick" == command_name)
{
- std::set<LLUUID> selection;
- if ( mCurrentSelectedList && mCurrentSelectedList->getRootFolder()->getSelectionList(selection) )
+ if (mCurrentSelectedList)
{
- return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
+ std::set<LLUUID> selection = mCurrentSelectedList->getRootFolder()->getSelectionList();
+ if (!selection.empty())
+ {
+ return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
+ }
}
return false;
}
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index 2d1eb0f091..8f8d9c2708 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -60,6 +60,7 @@ public:
/*virtual*/ void onShowProfile();
/*virtual*/ void onTeleport();
/*virtual*/ void updateVerbs();
+ /*virtual*/ bool isSingleItemSelected();
void onSelectionChange(LLPlacesInventoryPanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
void onSelectorButtonClicked();
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 67aea5544d..508a58e74f 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -51,11 +51,12 @@
#include "llfocusmgr.h"
#include "lllineeditor.h"
#include "llnotificationsutil.h"
+#include "llsecapi.h"
#include "llstartup.h"
#include "lltextbox.h"
#include "llui.h"
#include "lluiconstants.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
#include "llversioninfo.h"
#include "llviewerhelp.h"
#include "llviewertexturelist.h"
@@ -77,6 +78,7 @@
#pragma warning(disable: 4355) // 'this' used in initializer list
#endif // LL_WINDOWS
+#include "llsdserialize.h"
#define USE_VIEWER_AUTH 0
const S32 BLACK_BORDER_HEIGHT = 160;
@@ -104,7 +106,6 @@ public:
LLLoginRefreshHandler gLoginRefreshHandler;
-
// helper class that trys to download a URL from a web site and calls a method
// on parent class indicating if the web server is working or not
class LLIamHereLogin : public LLHTTPClient::Responder
@@ -153,10 +154,6 @@ namespace {
boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0;
};
-void set_start_location(LLUICtrl* ctrl, void* data)
-{
- LLURLSimString::setString(ctrl->getValue().asString());
-}
//---------------------------------------------------------------------------
// Public methods
@@ -187,6 +184,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
delete LLPanelLogin::sInstance;
}
+ mPasswordModified = FALSE;
LLPanelLogin::sInstance = this;
// add to front so we are the bottom-most child
@@ -213,10 +211,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
}
#if !USE_VIEWER_AUTH
- childSetPrevalidate("first_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
- childSetPrevalidate("last_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
-
- childSetCommitCallback("password_edit", mungePassword, this);
+ childSetPrevalidate("username_edit", LLTextValidate::validateASCIIPrintableNoPipe);
getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
// change z sort of clickable text to be behind buttons
@@ -226,29 +221,17 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
LLLineEditor* edit = getChild<LLLineEditor>("password_edit");
if (edit) edit->setDrawAsterixes(TRUE);
- LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
-
- std::string sim_string = LLURLSimString::sInstance.mSimString;
- if(sim_string.empty())
+ if(LLStartUp::getStartSLURL().getType() != LLSLURL::LOCATION)
{
- LLURLSimString::setString(gSavedSettings.getString("LoginLocation"));
- sim_string = LLURLSimString::sInstance.mSimString;
+ LLSLURL slurl(gSavedSettings.getString("LoginLocation"));
+ LLStartUp::setStartSLURL(slurl);
}
-
- if (!sim_string.empty())
- {
- // Replace "<Type region name>" with this region name
- combo->remove(2);
- combo->add( sim_string );
- combo->setTextEntry(sim_string);
- combo->setCurrentByIndex( 2 );
- }
-
- combo->setCommitCallback( &set_start_location, NULL );
+ updateLocationCombo(false);
LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
server_choice_combo->setCommitCallback(onSelectServer, NULL);
server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1));
+ updateServerCombo();
childSetAction("connect_btn", onClickConnect, this);
@@ -304,17 +287,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
// kick off a request to grab the url manually
gResponsePtr = LLIamHereLogin::build( this );
- std::string login_page = gSavedSettings.getString("LoginPage");
- if (login_page.empty())
- {
- login_page = getString( "real_url" );
- }
- LLHTTPClient::head( login_page, gResponsePtr );
-#if !USE_VIEWER_AUTH
- // Initialize visibility (and don't force visibility - use prefs)
- refreshLocation( false );
-#endif
+ LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
+
+ updateLocationCombo(false);
}
@@ -378,21 +354,6 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
}
}
-void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
-{
- LLPanelLogin* self = (LLPanelLogin*)user_data;
- LLLineEditor* editor = (LLLineEditor*)caller;
- std::string password = editor->getText();
-
- // Re-md5 if we've changed at all
- if (password != self->mIncomingPassword)
- {
- LLMD5 pass((unsigned char *)password.c_str());
- char munged_password[MD5HEX_STR_SIZE];
- pass.hex_digest(munged_password);
- self->mMungedPassword = munged_password;
- }
-}
LLPanelLogin::~LLPanelLogin()
{
@@ -493,14 +454,14 @@ void LLPanelLogin::giveFocus()
if( sInstance )
{
// Grab focus and move cursor to first blank input field
- std::string first = sInstance->childGetText("first_name_edit");
+ std::string username = sInstance->childGetText("username_edit");
std::string pass = sInstance->childGetText("password_edit");
- BOOL have_first = !first.empty();
+ BOOL have_username = !username.empty();
BOOL have_pass = !pass.empty();
LLLineEditor* edit = NULL;
- if (have_first && !have_pass)
+ if (have_username && !have_pass)
{
// User saved his name but not his password. Move
// focus to password field.
@@ -509,7 +470,7 @@ void LLPanelLogin::giveFocus()
else
{
// User doesn't have a name, so start there.
- edit = sInstance->getChild<LLLineEditor>("first_name_edit");
+ edit = sInstance->getChild<LLLineEditor>("username_edit");
}
if (edit)
@@ -531,8 +492,8 @@ void LLPanelLogin::showLoginWidgets()
// *TODO: Append all the usual login parameters, like first_login=Y etc.
std::string splash_screen_url = sInstance->getString("real_url");
web_browser->navigateTo( splash_screen_url, "text/html" );
- LLUICtrl* first_name_edit = sInstance->getChild<LLUICtrl>("first_name_edit");
- first_name_edit->setFocus(TRUE);
+ LLUICtrl* username_edit = sInstance->getChild<LLUICtrl>("username_edit");
+ username_edit->setFocus(TRUE);
}
// static
@@ -554,77 +515,127 @@ void LLPanelLogin::show(const LLRect &rect,
}
// static
-void LLPanelLogin::setFields(const std::string& firstname,
- const std::string& lastname,
- const std::string& password)
+void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
+ BOOL remember)
{
if (!sInstance)
{
llwarns << "Attempted fillFields with no login view shown" << llendl;
return;
}
+ LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;
- sInstance->childSetText("first_name_edit", firstname);
- sInstance->childSetText("last_name_edit", lastname);
-
- // Max "actual" password length is 16 characters.
- // Hex digests are always 32 characters.
- if (password.length() == 32)
+ LLSD identifier = credential->getIdentifier();
+ if((std::string)identifier["type"] == "agent")
+ {
+ sInstance->childSetText("username_edit", (std::string)identifier["first_name"] + " " +
+ (std::string)identifier["last_name"]);
+ }
+ else if((std::string)identifier["type"] == "account")
{
+ sInstance->childSetText("username_edit", (std::string)identifier["account_name"]);
+ }
+ else
+ {
+ sInstance->childSetText("username_edit", std::string());
+ }
+ // if the password exists in the credential, set the password field with
+ // a filler to get some stars
+ LLSD authenticator = credential->getAuthenticator();
+ LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
+ if(authenticator.isMap() &&
+ authenticator.has("secret") &&
+ (authenticator["secret"].asString().size() > 0))
+ {
+
// This is a MD5 hex digest of a password.
// We don't actually use the password input field,
// fill it with MAX_PASSWORD characters so we get a
// nice row of asterixes.
const std::string filler("123456789!123456");
- sInstance->childSetText("password_edit", filler);
- sInstance->mIncomingPassword = filler;
- sInstance->mMungedPassword = password;
+ sInstance->childSetText("password_edit", std::string("123456789!123456"));
}
else
{
- // this is a normal text password
- sInstance->childSetText("password_edit", password);
- sInstance->mIncomingPassword = password;
- LLMD5 pass((unsigned char *)password.c_str());
- char munged_password[MD5HEX_STR_SIZE];
- pass.hex_digest(munged_password);
- sInstance->mMungedPassword = munged_password;
+ sInstance->childSetText("password_edit", std::string());
}
+ sInstance->childSetValue("remember_check", remember);
}
// static
-void LLPanelLogin::addServer(const std::string& server, S32 domain_name)
+void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
+ BOOL& remember)
{
if (!sInstance)
{
- llwarns << "Attempted addServer with no login view shown" << llendl;
+ llwarns << "Attempted getFields with no login view shown" << llendl;
return;
}
+
+ // load the credential so we can pass back the stored password or hash if the user did
+ // not modify the password field.
+
+ credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
- LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
- combo->add(server, LLSD(domain_name) );
- combo->setCurrentByIndex(0);
-}
-
-// static
-void LLPanelLogin::getFields(std::string *firstname,
- std::string *lastname,
- std::string *password)
-{
- if (!sInstance)
+ LLSD identifier = LLSD::emptyMap();
+ LLSD authenticator = LLSD::emptyMap();
+
+ if(credential.notNull())
{
- llwarns << "Attempted getFields with no login view shown" << llendl;
- return;
+ authenticator = credential->getAuthenticator();
}
- *firstname = sInstance->childGetText("first_name_edit");
- LLStringUtil::trim(*firstname);
-
- *lastname = sInstance->childGetText("last_name_edit");
- LLStringUtil::trim(*lastname);
+ std::string username = sInstance->childGetText("username_edit");
+ LLStringUtil::trim(username);
+ std::string password = sInstance->childGetText("password_edit");
- *password = sInstance->mMungedPassword;
+ LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
+ // determine if the username is a first/last form or not.
+ size_t separator_index = username.find_first_of(' ');
+ if (separator_index == username.npos)
+ {
+ LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
+ // single username, so this is a 'clear' identifier
+ identifier["type"] = CRED_IDENTIFIER_TYPE_ACCOUNT;
+ identifier["account_name"] = username;
+
+ if (LLPanelLogin::sInstance->mPasswordModified)
+ {
+ authenticator = LLSD::emptyMap();
+ // password is plaintext
+ authenticator["type"] = CRED_AUTHENTICATOR_TYPE_CLEAR;
+ authenticator["secret"] = password;
+ }
+ }
+ else
+ {
+ std::string first = username.substr(0, separator_index);
+ std::string last = username.substr(separator_index, username.npos);
+ LLStringUtil::trim(last);
+
+ if (last.find_first_of(' ') == last.npos)
+ {
+ LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
+ // traditional firstname / lastname
+ identifier["type"] = CRED_IDENTIFIER_TYPE_AGENT;
+ identifier["first_name"] = first;
+ identifier["last_name"] = last;
+
+ if (LLPanelLogin::sInstance->mPasswordModified)
+ {
+ authenticator = LLSD::emptyMap();
+ authenticator["type"] = CRED_AUTHENTICATOR_TYPE_HASH;
+ authenticator["algorithm"] = "md5";
+ LLMD5 pass((const U8 *)password.c_str());
+ char md5pass[33]; /* Flawfinder: ignore */
+ pass.hex_digest(md5pass);
+ authenticator["secret"] = md5pass;
+ }
+ }
+ }
+ credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator);
+ remember = sInstance->childGetValue("remember_check");
}
// static
@@ -644,64 +655,112 @@ BOOL LLPanelLogin::isGridComboDirty()
}
// static
-void LLPanelLogin::getLocation(std::string &location)
+BOOL LLPanelLogin::areCredentialFieldsDirty()
{
if (!sInstance)
{
- llwarns << "Attempted getLocation with no login view shown" << llendl;
- return;
+ llwarns << "Attempted getServer with no login view shown" << llendl;
}
-
- LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
- location = combo->getValue().asString();
+ else
+ {
+ std::string username = sInstance->childGetText("username_edit");
+ LLStringUtil::trim(username);
+ std::string password = sInstance->childGetText("password_edit");
+ LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("username_edit");
+ if(ctrl && ctrl->isDirty())
+ {
+ return true;
+ }
+ ctrl = sInstance->getChild<LLLineEditor>("password_edit");
+ if(ctrl && ctrl->isDirty())
+ {
+ return true;
+ }
+ }
+ return false;
}
+
// static
-void LLPanelLogin::refreshLocation( bool force_visible )
+void LLPanelLogin::updateLocationCombo( bool force_visible )
{
- if (!sInstance) return;
-
-#if USE_VIEWER_AUTH
- loadLoginPage();
-#else
+ if (!sInstance)
+ {
+ return;
+ }
+
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+
+ switch(LLStartUp::getStartSLURL().getType())
+ {
+ case LLSLURL::LOCATION:
+ {
+
+ combo->setCurrentByIndex( 2 );
+ combo->setTextEntry(LLStartUp::getStartSLURL().getLocationString());
+ break;
+ }
+ case LLSLURL::HOME_LOCATION:
+ combo->setCurrentByIndex(1);
+ break;
+ default:
+ combo->setCurrentByIndex(0);
+ break;
+ }
+
BOOL show_start = TRUE;
-
+
if ( ! force_visible )
- {
- // Don't show on first run after install
- // Otherwise ShowStartLocation defaults to true.
show_start = gSavedSettings.getBOOL("ShowStartLocation");
- }
-
- // Update the value of the location combo.
- updateLocationUI();
sInstance->childSetVisible("start_location_combo", show_start);
sInstance->childSetVisible("start_location_text", show_start);
-
+
BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
+ sInstance->childSetVisible("server_combo_text", show_server);
sInstance->childSetVisible("server_combo", show_server);
-
-#endif
}
// static
-void LLPanelLogin::updateLocationUI()
+void LLPanelLogin::updateStartSLURL()
{
if (!sInstance) return;
- std::string sim_string = LLURLSimString::sInstance.mSimString;
- if (!sim_string.empty())
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+ S32 index = combo->getCurrentIndex();
+
+ switch (index)
{
- // Replace "<Type region name>" with this region name
- LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
- combo->remove(2);
- combo->add( sim_string );
- combo->setTextEntry(sim_string);
- combo->setCurrentByIndex( 2 );
+ case 0:
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+ break;
+ }
+ case 1:
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+ break;
+ }
+ default:
+ {
+ LLSLURL slurl = LLSLURL(combo->getValue().asString());
+ if(slurl.getType() == LLSLURL::LOCATION)
+ {
+ // we've changed the grid, so update the grid selection
+ LLStartUp::setStartSLURL(slurl);
+ }
+ break;
+ }
}
}
+
+void LLPanelLogin::setLocation(const LLSLURL& slurl)
+{
+ LLStartUp::setStartSLURL(slurl);
+ updateServer();
+}
+
// static
void LLPanelLogin::closePanel()
{
@@ -735,15 +794,13 @@ void LLPanelLogin::loadLoginPage()
std::ostringstream oStr;
- std::string login_page = gSavedSettings.getString("LoginPage");
- if (login_page.empty())
- {
- login_page = sInstance->getString( "real_url" );
- }
+ std::string login_page = LLGridManager::getInstance()->getLoginPage();
+
oStr << login_page;
// Use the right delimeter depending on how LLURI parses the URL
LLURI login_page_uri = LLURI(login_page);
+
std::string first_query_delimiter = "&";
if (login_page_uri.queryMap().size() == 0)
{
@@ -775,11 +832,10 @@ void LLPanelLogin::loadLoginPage()
curl_free(curl_version);
// Grid
- char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0);
+ char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLoginID().c_str(), 0);
oStr << "&grid=" << curl_grid;
curl_free(curl_grid);
-
- gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
+ gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
@@ -804,30 +860,20 @@ void LLPanelLogin::loadLoginPage()
location = gSavedSettings.getString("LoginLocation");
}
- std::string firstname, lastname;
+ std::string username;
if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
{
LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
- firstname = cmd_line_login[0].asString();
- lastname = cmd_line_login[1].asString();
+ username = cmd_line_login[0].asString() + " " + cmd_line_login[1];
password = cmd_line_login[2].asString();
}
- if (firstname.empty())
- {
- firstname = gSavedSettings.getString("FirstName");
- }
-
- if (lastname.empty())
- {
- lastname = gSavedSettings.getString("LastName");
- }
char* curl_region = curl_escape(region.c_str(), 0);
- oStr <<"firstname=" << firstname <<
- "&lastname=" << lastname << "&location=" << location << "&region=" << curl_region;
+ oStr <<"username=" << username <<
+ "&location=" << location << "&region=" << curl_region;
curl_free(curl_region);
@@ -860,7 +906,7 @@ void LLPanelLogin::loadLoginPage()
#endif
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
-
+
// navigate to the "real" page
if (gSavedSettings.getBOOL("RegInClient"))
{
@@ -909,39 +955,66 @@ void LLPanelLogin::onClickConnect(void *)
// JC - Make sure the fields all get committed.
sInstance->setFocus(FALSE);
- std::string first = sInstance->childGetText("first_name_edit");
- std::string last = sInstance->childGetText("last_name_edit");
- LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
- std::string combo_text = combo->getSimple();
-
- bool has_first_and_last = !(first.empty() || last.empty());
- bool has_location = false;
-
- if(combo_text=="<Type region name>" || combo_text =="")
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+ LLSD combo_val = combo->getSelectedValue();
+ if (combo_val.isUndefined())
+ {
+ combo_val = combo->getValue();
+ }
+ if(combo_val.isUndefined())
+ {
+ LLNotificationsUtil::add("StartRegionEmpty");
+ return;
+ }
+ try
{
- // *NOTE: Mani - Location field is not always committed by this point!
- // This may be duplicate work, but better than not doing the work!
- LLURLSimString::sInstance.setString("");
+ LLGridManager::getInstance()->setGridChoice(combo_val.asString());
}
- else
+ catch (LLInvalidGridName ex)
{
- // *NOTE: Mani - Location field is not always committed by this point!
- LLURLSimString::sInstance.setString(combo_text);
- has_location = true;
+ LLSD args;
+ args["GRID"] = combo_val.asString();
+ LLNotificationsUtil::add("InvalidGrid", args);
+ return;
}
+ updateStartSLURL();
+ std::string username = sInstance->childGetText("username_edit");
- if(!has_first_and_last)
+
+ if(username.empty())
{
+ // user must type in something into the username field
LLNotificationsUtil::add("MustHaveAccountToLogIn");
}
- else if(!has_location)
- {
- LLNotificationsUtil::add("StartRegionEmpty");
- }
else
{
- // has both first and last name typed
- sInstance->mCallback(0, sInstance->mCallbackData);
+ LLPointer<LLCredential> cred;
+ BOOL remember;
+ getFields(cred, remember);
+ std::string identifier_type;
+ cred->identifierType(identifier_type);
+ LLSD allowed_credential_types;
+ LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
+
+ // check the typed in credential type against the credential types expected by the server.
+ for(LLSD::array_iterator i = allowed_credential_types.beginArray();
+ i != allowed_credential_types.endArray();
+ i++)
+ {
+
+ if(i->asString() == identifier_type)
+ {
+ // yay correct credential type
+ sInstance->mCallback(0, sInstance->mCallbackData);
+ return;
+ }
+ }
+
+ // Right now, maingrid is the only thing that is picky about
+ // credential format, as it doesn't yet allow account (single username)
+ // format creds. - Rox. James, we wanna fix the message when we change
+ // this.
+ LLNotificationsUtil::add("InvalidCredentialFormat");
}
}
}
@@ -999,6 +1072,8 @@ void LLPanelLogin::onClickHelp(void*)
// static
void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
{
+ LLPanelLogin *This = (LLPanelLogin *) user_data;
+ This->mPasswordModified = TRUE;
if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
{
// *TODO: use another way to notify user about enabled caps lock, see EXT-6858
@@ -1006,54 +1081,88 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
}
}
-// static
-void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
-{
- // *NOTE: The paramters for this method are ignored.
- // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
- // calls this method.
-
- // The user twiddled with the grid choice ui.
- // apply the selection to the grid setting.
- std::string grid_label;
- S32 grid_index;
-
- LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
- LLSD combo_val = combo->getValue();
- if (LLSD::TypeInteger == combo_val.type())
+void LLPanelLogin::updateServer()
+{
+ try
{
- grid_index = combo->getValue().asInteger();
- if ((S32)GRID_INFO_OTHER == grid_index)
+ updateServerCombo();
+ // if they've selected another grid, we should load the credentials
+ // for that grid and set them to the UI.
+ if(sInstance && !sInstance->areCredentialFieldsDirty())
{
- // This happens if the user specifies a custom grid
- // via command line.
- grid_label = combo->getSimple();
+ LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
+ bool remember = sInstance->childGetValue("remember_check");
+ sInstance->setFields(credential, remember);
}
+ // grid changed so show new splash screen (possibly)
+ loadLoginPage();
+ updateLocationCombo(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION);
}
- else
+ catch (LLInvalidGridName ex)
{
- // no valid selection, return other
- grid_index = (S32)GRID_INFO_OTHER;
- grid_label = combo_val.asString();
+ // do nothing
}
+}
- // This new seelction will override preset uris
- // from the command line.
- LLViewerLogin* vl = LLViewerLogin::getInstance();
- vl->resetURIs();
- if(grid_index != GRID_INFO_OTHER)
+void LLPanelLogin::updateServerCombo()
+{
+ if (!sInstance)
{
- vl->setGridChoice((EGridInfo)grid_index);
+ return;
}
- else
+ // We add all of the possible values, sorted, and then add a bar and the current value at the top
+ LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
+ server_choice_combo->removeall();
+
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(!gSavedSettings.getBOOL("ShowBetaGrids"));
+
+ for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
+ grid_choice != known_grids.end();
+ grid_choice++)
{
- vl->setGridChoice(grid_label);
+ if (!grid_choice->first.empty())
+ {
+ server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED);
+ }
}
+
+ server_choice_combo->addSeparator(ADD_TOP);
+
+ server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(),
+ LLGridManager::getInstance()->getGrid(), ADD_TOP);
+
+ server_choice_combo->selectFirstItem();
+}
- // grid changed so show new splash screen (possibly)
- loadLoginPage();
+// static
+void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
+{
+ // *NOTE: The paramters for this method are ignored.
+ // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
+ // calls this method.
+ LL_INFOS("AppInit") << "onSelectServer" << LL_ENDL;
+ // The user twiddled with the grid choice ui.
+ // apply the selection to the grid setting.
+ LLPointer<LLCredential> credential;
+
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+ LLSD combo_val = combo->getSelectedValue();
+ if (combo_val.isUndefined())
+ {
+ combo_val = combo->getValue();
+ }
+
+ combo = sInstance->getChild<LLComboBox>("start_location_combo");
+ combo->setCurrentByIndex(1);
+ LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
+ LLGridManager::getInstance()->setGridChoice(combo_val.asString());
+ // This new selection will override preset uris
+ // from the command line.
+ updateServer();
+ updateLocationCombo(false);
+ updateLoginPanelLinks();
}
void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
@@ -1066,3 +1175,14 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
onSelectServer(combo, NULL);
}
}
+
+void LLPanelLogin::updateLoginPanelLinks()
+{
+ LLSD grid_data = LLGridManager::getInstance()->getGridInfo();
+ bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE);
+
+ // need to call through sInstance, as it's called from onSelectServer, which
+ // is static.
+ sInstance->childSetVisible("create_new_account_text", system_grid);
+ sInstance->childSetVisible("forgot_password_text", system_grid);
+}
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index 1fdc3a9361..aa6884ea97 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -41,6 +41,8 @@
class LLLineEditor;
class LLUIImage;
class LLPanelLoginListener;
+class LLSLURL;
+class LLCredential;
class LLPanelLogin:
public LLPanel,
@@ -65,20 +67,15 @@ public:
void (*callback)(S32 option, void* user_data),
void* callback_data);
- // Remember password checkbox is set via gSavedSettings "RememberPassword"
- static void setFields(const std::string& firstname, const std::string& lastname,
- const std::string& password);
+ static void setFields(LLPointer<LLCredential> credential, BOOL remember);
- static void addServer(const std::string& server, S32 domain_name);
- static void refreshLocation( bool force_visible );
- static void updateLocationUI();
-
- static void getFields(std::string *firstname, std::string *lastname,
- std::string *password);
+ static void getFields(LLPointer<LLCredential>& credential, BOOL& remember);
static BOOL isGridComboDirty();
- static void getLocation(std::string &location);
-
+ static BOOL areCredentialFieldsDirty();
+ static void setLocation(const LLSLURL& slurl);
+
+ static void updateLocationCombo(bool force_visible); // simply update the combo box
static void closePanel();
void setSiteIsAlive( bool alive );
@@ -86,10 +83,10 @@ public:
static void loadLoginPage();
static void giveFocus();
static void setAlwaysRefresh(bool refresh);
- static void mungePassword(LLUICtrl* caller, void* user_data);
// inherited from LLViewerMediaObserver
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+ static void updateServer(); // update the combo box, change the login page to the new server, clear the combo
private:
friend class LLPanelLoginListener;
@@ -103,6 +100,10 @@ private:
static void onPassKey(LLLineEditor* caller, void* user_data);
static void onSelectServer(LLUICtrl*, void*);
static void onServerComboLostFocus(LLFocusableElement*);
+ static void updateServerCombo();
+ static void updateStartSLURL();
+
+ static void updateLoginPanelLinks();
private:
LLPointer<LLUIImage> mLogoImage;
@@ -111,8 +112,7 @@ private:
void (*mCallback)(S32 option, void *userdata);
void* mCallbackData;
- std::string mIncomingPassword;
- std::string mMungedPassword;
+ BOOL mPasswordModified;
static LLPanelLogin* sInstance;
static BOOL sCapslockDidNotification;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 0ba373c51b..327196d9ba 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -167,7 +167,7 @@ BOOL LLPanelMainInventory::postBuild()
// Now load the stored settings from disk, if available.
std::ostringstream filterSaveName;
filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
- llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName << llendl;
+ llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName.str() << llendl;
llifstream file(filterSaveName.str());
LLSD savedFilterState;
if (file.is_open())
@@ -492,6 +492,10 @@ void LLPanelMainInventory::onFilterSelected()
{
return;
}
+
+ BOOL recent_active = ("Recent Items" == mActivePanel->getName());
+ childSetVisible("add_btn_panel", !recent_active);
+
setFilterSubString(mFilterSubString);
LLInventoryFilter* filter = mActivePanel->getFilter();
LLFloaterInventoryFinder *finder = getFinder();
@@ -1095,8 +1099,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
if (root)
{
can_delete = TRUE;
- std::set<LLUUID> selection_set;
- root->getSelectionList(selection_set);
+ std::set<LLUUID> selection_set = root->getSelectionList();
if (selection_set.empty()) return FALSE;
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 3a82cf6f8b..de16f9d343 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -83,16 +83,17 @@ protected:
mutable std::string mDisplayName;
LLPanelObjectInventory* mPanel;
U32 mFlags;
+ LLAssetType::EType mAssetType;
+ LLInventoryType::EType mInventoryType;
LLInventoryItem* findItem() const;
public:
- LLTaskInvFVBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- U32 flags=0);
- virtual ~LLTaskInvFVBridge( void ) {}
+ LLTaskInvFVBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name,
+ U32 flags=0);
+ virtual ~LLTaskInvFVBridge() {}
virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
@@ -149,9 +150,16 @@ LLTaskInvFVBridge::LLTaskInvFVBridge(
mUUID(uuid),
mName(name),
mPanel(panel),
- mFlags(flags)
+ mFlags(flags),
+ mAssetType(LLAssetType::AT_NONE),
+ mInventoryType(LLInventoryType::IT_NONE)
{
-
+ const LLInventoryItem *item = findItem();
+ if (item)
+ {
+ mAssetType = item->getType();
+ mInventoryType = item->getInventoryType();
+ }
}
LLInventoryItem* LLTaskInvFVBridge::findItem() const
@@ -345,13 +353,9 @@ time_t LLTaskInvFVBridge::getCreationDate() const
LLUIImagePtr LLTaskInvFVBridge::getIcon() const
{
- BOOL item_is_multi = FALSE;
- if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
- {
- item_is_multi = TRUE;
- }
+ const BOOL item_is_multi = (mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS);
- return get_item_icon(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT, 0, item_is_multi );
+ return LLInventoryIcon::getIcon(mAssetType, mInventoryType, FALSE, 0, item_is_multi );
}
void LLTaskInvFVBridge::openItem()
@@ -371,8 +375,7 @@ BOOL LLTaskInvFVBridge::isItemRenameable() const
LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
if(object)
{
- LLInventoryItem* item;
- item = (LLInventoryItem*)(object->getInventoryObject(mUUID));
+ LLInventoryItem* item = (LLInventoryItem*)(object->getInventoryObject(mUUID));
if(item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
GP_OBJECT_MANIPULATE, GOD_LIKE))
{
@@ -867,33 +870,14 @@ BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop,
class LLTaskTextureBridge : public LLTaskInvFVBridge
{
public:
- LLTaskTextureBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- LLInventoryType::EType it);
+ LLTaskTextureBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual LLUIImagePtr getIcon() const;
virtual void openItem();
-protected:
- LLInventoryType::EType mInventoryType;
};
-LLTaskTextureBridge::LLTaskTextureBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- LLInventoryType::EType it) :
- LLTaskInvFVBridge(panel, uuid, name),
- mInventoryType(it)
-{
-}
-
-LLUIImagePtr LLTaskTextureBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_TEXTURE, mInventoryType, 0, FALSE);
-}
-
void LLTaskTextureBridge::openItem()
{
llinfos << "LLTaskTextureBridge::openItem()" << llendl;
@@ -912,31 +896,17 @@ void LLTaskTextureBridge::openItem()
class LLTaskSoundBridge : public LLTaskInvFVBridge
{
public:
- LLTaskSoundBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
+ LLTaskSoundBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual LLUIImagePtr getIcon() const;
virtual void openItem();
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
static void openSoundPreview(void* data);
};
-LLTaskSoundBridge::LLTaskSoundBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
-{
-}
-
-LLUIImagePtr LLTaskSoundBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE);
-}
-
void LLTaskSoundBridge::openItem()
{
openSoundPreview((void*)this);
@@ -1038,28 +1008,12 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
class LLTaskLandmarkBridge : public LLTaskInvFVBridge
{
public:
- LLTaskLandmarkBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
-
- virtual LLUIImagePtr getIcon() const;
+ LLTaskLandmarkBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
};
-LLTaskLandmarkBridge::LLTaskLandmarkBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
-{
-}
-
-LLUIImagePtr LLTaskLandmarkBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, 0, FALSE);
-}
-
-
///----------------------------------------------------------------------------
/// Class LLTaskCallingCardBridge
///----------------------------------------------------------------------------
@@ -1067,29 +1021,15 @@ LLUIImagePtr LLTaskLandmarkBridge::getIcon() const
class LLTaskCallingCardBridge : public LLTaskInvFVBridge
{
public:
- LLTaskCallingCardBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
+ LLTaskCallingCardBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual LLUIImagePtr getIcon() const;
virtual BOOL isItemRenameable() const;
virtual BOOL renameItem(const std::string& new_name);
};
-LLTaskCallingCardBridge::LLTaskCallingCardBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
-{
-}
-
-LLUIImagePtr LLTaskCallingCardBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, 0, FALSE);
-}
-
BOOL LLTaskCallingCardBridge::isItemRenameable() const
{
return FALSE;
@@ -1108,36 +1048,21 @@ BOOL LLTaskCallingCardBridge::renameItem(const std::string& new_name)
class LLTaskScriptBridge : public LLTaskInvFVBridge
{
public:
- LLTaskScriptBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
+ LLTaskScriptBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual LLUIImagePtr getIcon() const;
//static BOOL enableIfCopyable( void* userdata );
};
-LLTaskScriptBridge::LLTaskScriptBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
-{
-}
-
-LLUIImagePtr LLTaskScriptBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
-}
-
-
class LLTaskLSLBridge : public LLTaskScriptBridge
{
public:
- LLTaskLSLBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
+ LLTaskLSLBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskScriptBridge(panel, uuid, name) {}
virtual void openItem();
virtual BOOL removeItem();
@@ -1146,14 +1071,6 @@ public:
//static void copyToInventory(void* userdata);
};
-LLTaskLSLBridge::LLTaskLSLBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskScriptBridge(panel, uuid, name)
-{
-}
-
void LLTaskLSLBridge::openItem()
{
llinfos << "LLTaskLSLBridge::openItem() " << mUUID << llendl;
@@ -1189,35 +1106,13 @@ BOOL LLTaskLSLBridge::removeItem()
class LLTaskObjectBridge : public LLTaskInvFVBridge
{
public:
- LLTaskObjectBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- U32 flags = 0);
-
- virtual LLUIImagePtr getIcon() const;
+ LLTaskObjectBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name,
+ U32 flags = 0) :
+ LLTaskInvFVBridge(panel, uuid, name, flags) {}
};
-LLTaskObjectBridge::LLTaskObjectBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- U32 flags) :
- LLTaskInvFVBridge(panel, uuid, name, flags)
-{
-}
-
-LLUIImagePtr LLTaskObjectBridge::getIcon() const
-{
- BOOL item_is_multi = FALSE;
- if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
- {
- item_is_multi = TRUE;
- }
-
- return get_item_icon(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT, 0, item_is_multi);
-}
-
///----------------------------------------------------------------------------
/// Class LLTaskNotecardBridge
///----------------------------------------------------------------------------
@@ -1225,29 +1120,15 @@ LLUIImagePtr LLTaskObjectBridge::getIcon() const
class LLTaskNotecardBridge : public LLTaskInvFVBridge
{
public:
- LLTaskNotecardBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
+ LLTaskNotecardBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual LLUIImagePtr getIcon() const;
virtual void openItem();
virtual BOOL removeItem();
};
-LLTaskNotecardBridge::LLTaskNotecardBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
-{
-}
-
-LLUIImagePtr LLTaskNotecardBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE);
-}
-
void LLTaskNotecardBridge::openItem()
{
LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
@@ -1278,29 +1159,15 @@ BOOL LLTaskNotecardBridge::removeItem()
class LLTaskGestureBridge : public LLTaskInvFVBridge
{
public:
- LLTaskGestureBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
+ LLTaskGestureBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual LLUIImagePtr getIcon() const;
virtual void openItem();
virtual BOOL removeItem();
};
-LLTaskGestureBridge::LLTaskGestureBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
-{
-}
-
-LLUIImagePtr LLTaskGestureBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE);
-}
-
void LLTaskGestureBridge::openItem()
{
LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
@@ -1325,29 +1192,15 @@ BOOL LLTaskGestureBridge::removeItem()
class LLTaskAnimationBridge : public LLTaskInvFVBridge
{
public:
- LLTaskAnimationBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
+ LLTaskAnimationBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual LLUIImagePtr getIcon() const;
virtual void openItem();
virtual BOOL removeItem();
};
-LLTaskAnimationBridge::LLTaskAnimationBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
-{
-}
-
-LLUIImagePtr LLTaskAnimationBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE);
-}
-
void LLTaskAnimationBridge::openItem()
{
LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
@@ -1376,33 +1229,18 @@ BOOL LLTaskAnimationBridge::removeItem()
class LLTaskWearableBridge : public LLTaskInvFVBridge
{
public:
- LLTaskWearableBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- LLAssetType::EType asset_type,
- U32 flags);
+ LLTaskWearableBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name,
+ U32 flags) :
+ LLTaskInvFVBridge(panel, uuid, name, flags) {}
virtual LLUIImagePtr getIcon() const;
-
-protected:
- LLAssetType::EType mAssetType;
};
-LLTaskWearableBridge::LLTaskWearableBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- LLAssetType::EType asset_type,
- U32 flags) :
- LLTaskInvFVBridge(panel, uuid, name, flags),
- mAssetType( asset_type )
-{
-}
-
LLUIImagePtr LLTaskWearableBridge::getIcon() const
{
- return get_item_icon(mAssetType, LLInventoryType::IT_WEARABLE, mFlags, FALSE );
+ return LLInventoryIcon::getIcon(mAssetType, mInventoryType, FALSE, mFlags, FALSE );
}
@@ -1414,16 +1252,15 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory*
LLInventoryObject* object)
{
LLTaskInvFVBridge* new_bridge = NULL;
+ const LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(object);
LLAssetType::EType type = object->getType();
- LLInventoryItem* item = NULL;
+
switch(type)
{
case LLAssetType::AT_TEXTURE:
- item = (LLInventoryItem*)object;
new_bridge = new LLTaskTextureBridge(panel,
object->getUUID(),
- object->getName(),
- item->getInventoryType());
+ object->getName());
break;
case LLAssetType::AT_SOUND:
new_bridge = new LLTaskSoundBridge(panel,
@@ -1449,13 +1286,11 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory*
break;
case LLAssetType::AT_OBJECT:
{
- item = dynamic_cast<LLInventoryItem*>(object);
- U32 flags = ( NULL == item ? 0 : item->getFlags() );
-
- new_bridge = new LLTaskObjectBridge(panel,
- object->getUUID(),
- object->getName(),
- flags);
+ U32 flags = ( NULL == item ? 0 : item->getFlags() );
+ new_bridge = new LLTaskObjectBridge(panel,
+ object->getUUID(),
+ object->getName(),
+ flags);
}
break;
case LLAssetType::AT_NOTECARD:
@@ -1475,11 +1310,9 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory*
break;
case LLAssetType::AT_CLOTHING:
case LLAssetType::AT_BODYPART:
- item = (LLInventoryItem*)object;
new_bridge = new LLTaskWearableBridge(panel,
object->getUUID(),
object->getName(),
- type,
item->getFlags());
break;
case LLAssetType::AT_CATEGORY:
@@ -1492,8 +1325,6 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory*
object->getUUID(),
object->getName());
break;
-
- break;
default:
llinfos << "Unhandled inventory type (llassetstorage.h): "
<< (S32)type << llendl;
@@ -1658,7 +1489,7 @@ void LLPanelObjectInventory::updateInventory()
BOOL inventory_has_focus = FALSE;
if (mHaveInventory)
{
- mFolders->getSelectionList(selected_items);
+ selected_items = mFolders->getSelectionList();
inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders);
}
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index daa41e1467..c04be85174 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -77,11 +77,16 @@ const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK;
static const std::string SAVE_BTN("save_btn");
static const std::string REVERT_BTN("revert_btn");
-class LLInventoryLookObserver : public LLInventoryObserver
+class LLCOFObserver : public LLInventoryObserver
{
public:
- LLInventoryLookObserver(LLPanelOutfitEdit *panel) : mPanel(panel) {}
- virtual ~LLInventoryLookObserver()
+ LLCOFObserver(LLPanelOutfitEdit *panel) : mPanel(panel),
+ mCOFLastVersion(LLViewerInventoryCategory::VERSION_UNKNOWN)
+ {
+ gInventory.addObserver(this);
+ }
+
+ virtual ~LLCOFObserver()
{
if (gInventory.containsObserver(this))
{
@@ -91,51 +96,92 @@ public:
virtual void changed(U32 mask)
{
- if (mask & (LLInventoryObserver::ADD | LLInventoryObserver::REMOVE))
+ if (!gInventory.isInventoryUsable()) return;
+
+ bool panel_updated = checkCOF();
+
+ if (!panel_updated)
{
- mPanel->updateLookInfo();
+ checkBaseOutfit();
}
}
+
protected:
- LLPanelOutfitEdit *mPanel;
-};
-class LLLookFetchObserver : public LLInventoryFetchDescendentsObserver
-{
-public:
- LLLookFetchObserver(LLPanelOutfitEdit *panel) :
- mPanel(panel)
- {}
- LLLookFetchObserver() {}
- virtual void done()
+ /** Get a version of an inventory category specified by its UUID */
+ static S32 getCategoryVersion(const LLUUID& cat_id)
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (!cat) return LLViewerInventoryCategory::VERSION_UNKNOWN;
+
+ return cat->getVersion();
+ }
+
+ bool checkCOF()
+ {
+ LLUUID cof = LLAppearanceMgr::getInstance()->getCOF();
+ if (cof.isNull()) return false;
+
+ S32 cof_version = getCategoryVersion(cof);
+
+ if (cof_version == mCOFLastVersion) return false;
+
+ mCOFLastVersion = cof_version;
+
+ mPanel->update();
+
+ return true;
+ }
+
+ void checkBaseOutfit()
{
- mPanel->lookFetched();
- if(gInventory.containsObserver(this))
+ LLUUID baseoutfit_id = LLAppearanceMgr::getInstance()->getBaseOutfitUUID();
+
+ if (baseoutfit_id == mBaseOutfitId)
{
- gInventory.removeObserver(this);
+ if (baseoutfit_id.isNull()) return;
+
+ const S32 baseoutfit_ver = getCategoryVersion(baseoutfit_id);
+
+ if (baseoutfit_ver == mBaseOutfitLastVersion) return;
}
+ else
+ {
+ mBaseOutfitId = baseoutfit_id;
+ if (baseoutfit_id.isNull()) return;
+
+ mBaseOutfitLastVersion = getCategoryVersion(mBaseOutfitId);
+ }
+
+ mPanel->updateVerbs();
}
-private:
+
+
+
+
LLPanelOutfitEdit *mPanel;
+
+ //last version number of a COF category
+ S32 mCOFLastVersion;
+
+ LLUUID mBaseOutfitId;
+
+ S32 mBaseOutfitLastVersion;
};
LLPanelOutfitEdit::LLPanelOutfitEdit()
: LLPanel(),
- mCurrentOutfitID(),
- mFetchLook(NULL),
mSearchFilter(NULL),
mCOFWearables(NULL),
mInventoryItemsPanel(NULL),
- mLookObserver(NULL)
+ mCOFObserver(NULL)
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(FALSE);
- mFetchLook = new LLLookFetchObserver(this);
- mLookObserver = new LLInventoryLookObserver(this);
- gInventory.addObserver(mLookObserver);
+ mCOFObserver = new LLCOFObserver(this);
mLookItemTypes.reserve(NUM_LOOK_ITEM_TYPES);
for (U32 i = 0; i < NUM_LOOK_ITEM_TYPES; i++)
@@ -149,17 +195,8 @@ LLPanelOutfitEdit::LLPanelOutfitEdit()
LLPanelOutfitEdit::~LLPanelOutfitEdit()
{
delete mSavedFolderState;
- if (gInventory.containsObserver(mFetchLook))
- {
- gInventory.removeObserver(mFetchLook);
- }
- delete mFetchLook;
-
- if (gInventory.containsObserver(mLookObserver))
- {
- gInventory.removeObserver(mLookObserver);
- }
- delete mLookObserver;
+
+ delete mCOFObserver;
}
BOOL LLPanelOutfitEdit::postBuild()
@@ -171,8 +208,13 @@ BOOL LLPanelOutfitEdit::postBuild()
mLookItemTypes[LIT_ATTACHMENT] = LLLookItemType(getString("Filter.Objects"), ATTACHMENT_MASK);
mCurrentOutfitName = getChild<LLTextBox>("curr_outfit_name");
+ mStatus = getChild<LLTextBox>("status");
+
+ mFolderViewBtn = getChild<LLButton>("folder_view_btn");
+ mListViewBtn = getChild<LLButton>("list_view_btn");
childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
+ childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredFolderWearablesPanel, this), NULL);
childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL);
mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
@@ -204,15 +246,7 @@ BOOL LLPanelOutfitEdit::postBuild()
mSearchFilter = getChild<LLFilterEditor>("look_item_filter");
mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2));
- /* Removing add to look inline button (not part of mvp for viewer 2)
- LLButton::Params add_params;
- add_params.name("add_to_look");
- add_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this));
- add_params.label("+");
-
- mAddToLookBtn = LLUICtrlFactory::create<LLButton>(add_params);
- mAddToLookBtn->setEnabled(FALSE);
- mAddToLookBtn->setVisible(FALSE); */
+ childSetAction("add_to_outfit_btn", boost::bind(&LLPanelOutfitEdit::onAddToOutfitClicked, this));
mEditWearableBtn = getChild<LLButton>("edit_wearable_btn");
mEditWearableBtn->setEnabled(FALSE);
@@ -229,8 +263,9 @@ BOOL LLPanelOutfitEdit::postBuild()
save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true));
mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mWearableListManager = new LLFilteredWearableListManager(
- getChild<LLInventoryItemsList>("filtered_wearables_list"), ALL_ITEMS_MASK);
+ mWearableItemsPanel = getChild<LLPanel>("filtered_wearables_panel");
+ mWearableItemsList = getChild<LLInventoryItemsList>("filtered_wearables_list");
+ mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, ALL_ITEMS_MASK);
return TRUE;
}
@@ -242,9 +277,6 @@ void LLPanelOutfitEdit::moveWearable(bool closer_to_body)
LLViewerInventoryItem* wearable_to_move = gInventory.getItem(item_id);
LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body);
-
- //*TODO why not to listen to inventory?
- updateLookInfo();
}
void LLPanelOutfitEdit::toggleAddWearablesPanel()
@@ -254,12 +286,33 @@ void LLPanelOutfitEdit::toggleAddWearablesPanel()
void LLPanelOutfitEdit::showWearablesFilter()
{
- childSetVisible("filter_combobox_panel", childGetValue("filter_button"));
+ bool filter_visible = childGetValue("filter_button");
+
+ childSetVisible("filter_panel", filter_visible);
+
+ if(!filter_visible)
+ {
+ mSearchFilter->clear();
+ onSearchEdit(LLStringUtil::null);
+ }
}
void LLPanelOutfitEdit::showFilteredWearablesPanel()
{
- childSetVisible("filtered_wearables_panel", !childIsVisible("filtered_wearables_panel"));
+ if(switchPanels(mInventoryItemsPanel, mWearableItemsPanel))
+ {
+ mFolderViewBtn->setToggleState(FALSE);
+ }
+ mListViewBtn->setToggleState(TRUE);
+}
+
+void LLPanelOutfitEdit::showFilteredFolderWearablesPanel()
+{
+ if(switchPanels(mWearableItemsPanel, mInventoryItemsPanel))
+ {
+ mListViewBtn->setToggleState(FALSE);
+ }
+ mFolderViewBtn->setToggleState(TRUE);
}
void LLPanelOutfitEdit::saveOutfit(bool as_new)
@@ -324,7 +377,7 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
if (mSearchString == "")
{
mInventoryItemsPanel->setFilterSubString(LLStringUtil::null);
-
+ mWearableItemsList->setFilterSubString(LLStringUtil::null);
// re-open folders that were initially open
mSavedFolderState->setApply(TRUE);
mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
@@ -350,6 +403,8 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
// set new filter string
mInventoryItemsPanel->setFilterSubString(mSearchString);
+ mWearableItemsList->setFilterSubString(mSearchString);
+
}
void LLPanelOutfitEdit::onAddToOutfitClicked(void)
@@ -360,10 +415,7 @@ void LLPanelOutfitEdit::onAddToOutfitClicked(void)
LLFolderViewEventListener* listenerp = curr_item->getListener();
if (!listenerp) return;
- if (LLAppearanceMgr::getInstance()->wearItemOnAvatar(listenerp->getUUID()))
- {
- updateLookInfo();
- }
+ LLAppearanceMgr::getInstance()->wearItemOnAvatar(listenerp->getUUID());
}
@@ -372,8 +424,6 @@ void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)
LLUUID id_to_remove = mCOFWearables->getSelectedUUID();
LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove);
-
- updateLookInfo();
}
@@ -465,34 +515,13 @@ void LLPanelOutfitEdit::onOutfitItemSelectionChange(void)
}
}
-void LLPanelOutfitEdit::changed(U32 mask)
-{
-}
-
-void LLPanelOutfitEdit::lookFetched(void)
+void LLPanelOutfitEdit::update()
{
mCOFWearables->refresh();
updateVerbs();
}
-void LLPanelOutfitEdit::updateLookInfo()
-{
- if (getVisible())
- {
- mFetchLook->setFetchID(mCurrentOutfitID);
- mFetchLook->startFetch();
- if (mFetchLook->isFinished())
- {
- mFetchLook->done();
- }
- else
- {
- gInventory.addObserver(mFetchLook);
- }
- }
-}
-
void LLPanelOutfitEdit::displayCurrentOutfit()
{
if (!getVisible())
@@ -500,8 +529,6 @@ void LLPanelOutfitEdit::displayCurrentOutfit()
setVisible(TRUE);
}
- mCurrentOutfitID = LLAppearanceMgr::getInstance()->getCOF();
-
std::string current_outfit_name;
if (LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name))
{
@@ -512,18 +539,36 @@ void LLPanelOutfitEdit::displayCurrentOutfit()
mCurrentOutfitName->setText(getString("No Outfit"));
}
- updateLookInfo();
+ update();
}
//private
void LLPanelOutfitEdit::updateVerbs()
{
+ //*TODO implement better handling of COF dirtiness
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+
bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
-
+ bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull();
+
childSetEnabled(SAVE_BTN, outfit_is_dirty);
- childSetEnabled(REVERT_BTN, outfit_is_dirty);
+ childSetEnabled(REVERT_BTN, outfit_is_dirty && has_baseoutfit);
mSaveMenu->setItemEnabled("save_outfit", outfit_is_dirty);
+
+ mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing"));
+
+}
+
+bool LLPanelOutfitEdit::switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel)
+{
+ if(switch_from_panel && switch_to_panel && !switch_to_panel->getVisible())
+ {
+ switch_from_panel->setVisible(FALSE);
+ switch_to_panel->setVisible(TRUE);
+ return true;
+ }
+ return false;
}
// EOF
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index 0074cd517b..cb8283fca3 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -42,19 +42,19 @@
#include "llremoteparcelrequest.h"
#include "llinventory.h"
+#include "llinventoryitemslist.h"
#include "llinventorymodel.h"
class LLButton;
class LLCOFWearables;
class LLTextBox;
class LLInventoryCategory;
-class LLInventoryLookObserver;
+class LLCOFObserver;
class LLInventoryPanel;
class LLSaveFolderState;
class LLFolderViewItem;
class LLScrollListCtrl;
class LLToggleableMenu;
-class LLLookFetchObserver;
class LLFilterEditor;
class LLFilteredWearableListManager;
@@ -82,17 +82,13 @@ public:
/*virtual*/ ~LLPanelOutfitEdit();
/*virtual*/ BOOL postBuild();
- /*virtual*/ void changed(U32 mask);
-
- /*virtual*/ void setParcelID(const LLUUID& parcel_id);
- // Sends a request for data about the given parcel, which will
- // only update the location if there is none already available.
void moveWearable(bool closer_to_body);
void toggleAddWearablesPanel();
void showWearablesFilter();
void showFilteredWearablesPanel();
+ void showFilteredFolderWearablesPanel();
void saveOutfit(bool as_new = false);
void showSaveMenu();
@@ -106,29 +102,38 @@ public:
void displayCurrentOutfit();
- void lookFetched(void);
-
- void updateLookInfo(void);
+ void update();
+
+ void updateVerbs();
+ /**
+ * @brief Helper function. Shows one panel instead of another.
+ * If panels already switched does nothing and returns false.
+ * @param switch_from_panel panel to hide
+ * @param switch_to_panel panel to show
+ * @retun returns true if switching happened, false if not.
+ */
+ bool switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel);
private:
- void updateVerbs();
- //*TODO got rid of mCurrentOutfitID
- LLUUID mCurrentOutfitID;
LLTextBox* mCurrentOutfitName;
+ LLTextBox* mStatus;
LLInventoryPanel* mInventoryItemsPanel;
LLFilterEditor* mSearchFilter;
LLSaveFolderState* mSavedFolderState;
std::string mSearchString;
LLButton* mEditWearableBtn;
+ LLButton* mFolderViewBtn;
+ LLButton* mListViewBtn;
LLToggleableMenu* mSaveMenu;
- LLFilteredWearableListManager* mWearableListManager;
+ LLFilteredWearableListManager* mWearableListManager;
+ LLInventoryItemsList* mWearableItemsList;
+ LLPanel* mWearableItemsPanel;
- LLLookFetchObserver* mFetchLook;
- LLInventoryLookObserver* mLookObserver;
+ LLCOFObserver* mCOFObserver;
std::vector<LLLookItemType> mLookItemTypes;
LLCOFWearables* mCOFWearables;
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 59c1fb4f3c..660615df5a 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -77,6 +77,7 @@ LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(FALSE);
+ gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoaded, this));
}
LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
@@ -90,6 +91,15 @@ BOOL LLPanelOutfitsInventory::postBuild()
initTabPanels();
initListCommandsHandlers();
+ // Fetch your outfits folder so that the links are in memory.
+ // ( This is only necessary if we want to show a warning if a user deletes an item that has a
+ // a link in an outfit, see "ConfirmItemDeleteHasLinks". )
+ const LLUUID &outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTFIT, false);
+ if (outfits_cat.notNull())
+ {
+ LLInventoryModelBackgroundFetch::instance().start(outfits_cat);
+ }
+
return TRUE;
}
@@ -190,6 +200,7 @@ void LLPanelOutfitsInventory::onWearButtonClick()
if (!isCOFPanelActive())
{
mMyOutfitsPanel->performAction("replaceoutfit");
+ setWearablesLoading(true);
}
else
{
@@ -482,8 +493,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
LLFolderView* root = getActivePanel()->getRootFolder();
if (root)
{
- std::set<LLUUID> selection_set;
- root->getSelectionList(selection_set);
+ std::set<LLUUID> selection_set = root->getSelectionList();
can_delete = (selection_set.size() > 0);
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
@@ -504,8 +514,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
LLFolderView* root = getActivePanel()->getRootFolder();
if (root)
{
- std::set<LLUUID> selection_set;
- root->getSelectionList(selection_set);
+ std::set<LLUUID> selection_set = root->getSelectionList();
can_delete = (selection_set.size() > 0);
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
@@ -557,8 +566,7 @@ bool LLPanelOutfitsInventory::hasItemsSelected()
LLFolderView* root = getActivePanel()->getRootFolder();
if (root)
{
- std::set<LLUUID> selection_set;
- root->getSelectionList(selection_set);
+ std::set<LLUUID> selection_set = root->getSelectionList();
has_items_selected = (selection_set.size() > 0);
}
}
@@ -642,3 +650,19 @@ BOOL LLPanelOutfitsInventory::isCOFPanelActive() const
{
return (childGetVisibleTab("appearance_tabs")->getName() == COF_TAB_NAME);
}
+
+void LLPanelOutfitsInventory::setWearablesLoading(bool val)
+{
+ mListCommands->childSetEnabled("wear_btn", !val);
+
+ llassert(mParent);
+ if (mParent)
+ {
+ mParent->setWearablesLoading(val);
+ }
+}
+
+void LLPanelOutfitsInventory::onWearablesLoaded()
+{
+ setWearablesLoading(false);
+}
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index 975d99f834..6b4d1dbd84 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -123,6 +123,8 @@ protected:
void onCustomAction(const LLSD& command_name);
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
bool hasItemsSelected();
+ void setWearablesLoading(bool val);
+ void onWearablesLoaded();
private:
LLPanel* mListCommands;
LLMenuGL* mMenuGearDefault;
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index f2c0f92f9b..0a4af00f78 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -624,7 +624,7 @@ BOOL LLPanelPeople::postBuild()
if(recent_view_sort)
mRecentViewSortMenuHandle = recent_view_sort->getHandle();
- gVoiceClient->addObserver(this);
+ LLVoiceClient::getInstance()->addObserver(this);
// call this method in case some list is empty and buttons can be in inconsistent state
updateButtons();
@@ -825,7 +825,7 @@ void LLPanelPeople::updateButtons()
}
}
- bool enable_calls = gVoiceClient->voiceWorking() && gVoiceClient->voiceEnabled();
+ bool enable_calls = LLVoiceClient::getInstance()->isVoiceWorking() && LLVoiceClient::getInstance()->voiceEnabled();
buttonSetEnabled("teleport_btn", friends_tab_active && item_selected && isFriendOnline(selected_uuids.front()));
buttonSetEnabled("view_profile_btn", item_selected);
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 51a11e97e4..028440562d 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -615,8 +615,21 @@ void LLPanelPlaces::onShowOnMapButtonClicked()
}
else
{
- if (mActivePanel)
+ if (mActivePanel && mActivePanel->isSingleItemSelected())
+ {
mActivePanel->onShowOnMap();
+ }
+ else
+ {
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ LLVector3d global_pos = gAgent.getPositionGlobal();
+
+ if (!global_pos.isExactlyZero() && worldmap_instance)
+ {
+ worldmap_instance->trackLocation(global_pos);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
+ }
}
}
@@ -1072,7 +1085,6 @@ void LLPanelPlaces::updateVerbs()
mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn);
mPlaceInfoBtn->setVisible(!is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn);
- mShowOnMapBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos);
mPlaceInfoBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos);
if (is_place_info_visible)
diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp
index 42cf3b03a3..0f3c51fb4f 100644
--- a/indra/newview/llpanelplacestab.cpp
+++ b/indra/newview/llpanelplacestab.cpp
@@ -71,10 +71,7 @@ void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos,
std::string sl_url;
if ( gotSimName )
{
- F32 region_x = (F32)fmod( landmark_global_pos.mdV[VX], (F64)REGION_WIDTH_METERS );
- F32 region_y = (F32)fmod( landmark_global_pos.mdV[VY], (F64)REGION_WIDTH_METERS );
-
- sl_url = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)landmark_global_pos.mdV[VZ]));
+ sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
}
else
{
diff --git a/indra/newview/llpanelplacestab.h b/indra/newview/llpanelplacestab.h
index f4e93a7658..4a155afd71 100644
--- a/indra/newview/llpanelplacestab.h
+++ b/indra/newview/llpanelplacestab.h
@@ -47,6 +47,7 @@ public:
virtual void onShowOnMap() = 0;
virtual void onShowProfile() = 0;
virtual void onTeleport() = 0;
+ virtual bool isSingleItemSelected() = 0;
bool isTabVisible(); // Check if parent TabContainer is visible.
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index c0b2244038..4dd03e04a9 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -38,7 +38,7 @@
#include "llsidetray.h"
#include "llworldmap.h"
#include "llteleporthistorystorage.h"
-#include "lltextutil.h"
+#include "lluitextutil.h"
#include "llaccordionctrl.h"
#include "llaccordionctrltab.h"
@@ -477,6 +477,12 @@ void LLTeleportHistoryPanel::onSearchEdit(const std::string& string)
}
// virtual
+bool LLTeleportHistoryPanel::isSingleItemSelected()
+{
+ return mLastSelectedFlatlList && mLastSelectedFlatlList->getSelectedItem();
+}
+
+// virtual
void LLTeleportHistoryPanel::onShowOnMap()
{
if (!mLastSelectedFlatlList)
@@ -557,7 +563,6 @@ void LLTeleportHistoryPanel::updateVerbs()
if (!mLastSelectedFlatlList)
{
mTeleportBtn->setEnabled(false);
- mShowOnMapBtn->setEnabled(false);
mShowProfile->setEnabled(false);
return;
}
@@ -565,8 +570,8 @@ void LLTeleportHistoryPanel::updateVerbs()
LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
mTeleportBtn->setEnabled(NULL != itemp);
- mShowOnMapBtn->setEnabled(NULL != itemp);
mShowProfile->setEnabled(NULL != itemp);
+ mShowOnMapBtn->setEnabled(true);
}
void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, LLDate& tab_date)
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index a456ca506f..1f2be63dc2 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -77,6 +77,7 @@ public:
/*virtual*/ void onTeleport();
///*virtual*/ void onCopySLURL();
/*virtual*/ void updateVerbs();
+ /*virtual*/ bool isSingleItemSelected();
private:
@@ -123,4 +124,6 @@ private:
LLHandle<LLView> mGearMenuHandle;
};
+
+
#endif //LL_LLPANELTELEPORTHISTORY_H
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index a058548459..daf116d255 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -37,6 +37,8 @@
#include "llavataractions.h"
#include "llagent.h"
+#include "llimview.h"
+#include "llnotificationsutil.h"
#include "llparticipantlist.h"
#include "llspeakers.h"
#include "llviewercontrol.h"
@@ -95,7 +97,7 @@ public:
void onChange()
{
uuid_set_t participant_uuids;
- LLVoiceClient::getInstance()->getParticipantsUUIDSet(participant_uuids);
+ LLVoiceClient::getInstance()->getParticipantList(participant_uuids);
// check whether Avaline caller exists among voice participants
@@ -558,9 +560,8 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
}
else
{
- LLVoiceClient::participantState *participant = LLVoiceClient::getInstance()->findParticipantByID(avatar_id);
-
- mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), participant ? participant->mAccountName : LLTrans::getString("AvatarNameWaiting"));
+ std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id);
+ mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? display_name : LLTrans::getString("AvatarNameWaiting"));
mAvalineUpdater->watchAvalineCaller(avatar_id);
}
adjustParticipant(avatar_id);
@@ -674,12 +675,10 @@ void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const
if (is_muted)
{
LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceMuteSelected", false);
- LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceMuteOthers", false);
}
else
{
LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteSelected", false);
- LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteOthers", false);
}
}
@@ -719,8 +718,10 @@ void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata,
{
return;
}
+ LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(mParent.mAvatarList->getItemByValue(speaker_id));
+ if (NULL == item) return;
- name = speakerp->mDisplayName;
+ name = item->getAvatarName();
LLMute::EType mute_type;
switch (speakerp->mType)
@@ -782,16 +783,17 @@ void LLParticipantList::LLParticipantListMenu::moderateVoice(const LLSD& userdat
if (!gAgent.getRegion()) return;
bool moderate_selected = userdata.asString() == "selected";
- const LLUUID& selected_avatar_id = mUUIDs.front();
- bool is_muted = isMuted(selected_avatar_id);
if (moderate_selected)
{
+ const LLUUID& selected_avatar_id = mUUIDs.front();
+ bool is_muted = isMuted(selected_avatar_id);
moderateVoiceParticipant(selected_avatar_id, is_muted);
}
else
{
- moderateVoiceOtherParticipants(selected_avatar_id, is_muted);
+ bool unmute_all = userdata.asString() == "unmute_all";
+ moderateVoiceOtherParticipants(LLUUID::null, unmute_all);
}
}
@@ -809,10 +811,43 @@ void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(co
LLIMSpeakerMgr* mgr = dynamic_cast<LLIMSpeakerMgr*>(mParent.mSpeakerMgr);
if (mgr)
{
+ if (!unmute)
+ {
+ LLSD payload;
+ payload["session_id"] = mgr->getSessionID();
+ payload["excluded_avatar_id"] = excluded_avatar_id;
+ LLNotificationsUtil::add("ConfirmMuteAll", LLSD(), payload, confirmMuteAllCallback);
+ return;
+ }
+
mgr->moderateVoiceOtherParticipants(excluded_avatar_id, unmute);
}
}
+// static
+void LLParticipantList::LLParticipantListMenu::confirmMuteAllCallback(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 1)
+ {
+ return;
+ }
+
+ const LLSD& payload = notification["payload"];
+ const LLUUID& session_id = payload["session_id"];
+ const LLUUID& excluded_avatar_id = payload["excluded_avatar_id"];
+
+ LLIMSpeakerMgr * speaker_manager = dynamic_cast<LLIMSpeakerMgr*> (
+ LLIMModel::getInstance()->getSpeakerManager(session_id));
+ if (speaker_manager)
+ {
+ speaker_manager->moderateVoiceOtherParticipants(excluded_avatar_id, false);
+ }
+
+ return;
+}
+
+
bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& userdata)
{
std::string item = userdata.asString();
@@ -853,7 +888,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
else if (item == "can_call")
{
bool not_agent = mUUIDs.front() != gAgentID;
- bool can_call = not_agent && LLVoiceClient::voiceEnabled() && LLVoiceClient::getInstance()->voiceWorking();
+ bool can_call = not_agent && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
return can_call;
}
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index bbef8baaac..abaf503868 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -216,6 +216,8 @@ class LLParticipantList
* @see moderateVoiceParticipant()
*/
void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute);
+
+ static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response);
};
/**
diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp
index 11b6c0a3ae..b68fc3b002 100644
--- a/indra/newview/llscriptfloater.cpp
+++ b/indra/newview/llscriptfloater.cpp
@@ -482,7 +482,7 @@ std::string LLScriptFloaterManager::getObjectName(const LLUUID& notification_id)
text = notification->getSubstitutions()["OBJECTNAME"].asString();
break;
case LLScriptFloaterManager::OBJ_GIVE_INVENTORY:
- text = notification->getSubstitutions()["NAME"].asString();
+ text = notification->getSubstitutions()["OBJECTFROMNAME"].asString();
break;
default:
text = LLTrans::getString("object");
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
new file mode 100644
index 0000000000..89b799f297
--- /dev/null
+++ b/indra/newview/llsecapi.cpp
@@ -0,0 +1,194 @@
+/**
+ * @file llsecapi.cpp
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+#include "llsecapi.h"
+#include "llsechandler_basic.h"
+#include <openssl/evp.h>
+#include <openssl/err.h>
+#include <map>
+#include "llhttpclient.h"
+
+
+
+std::map<std::string, LLPointer<LLSecAPIHandler> > gHandlerMap;
+LLPointer<LLSecAPIHandler> gSecAPIHandler;
+
+void initializeSecHandler()
+{
+ ERR_load_crypto_strings();
+ OpenSSL_add_all_algorithms();
+
+ gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
+
+
+ // Currently, we only have the Basic handler, so we can point the main sechandler
+ // pointer to the basic handler. Later, we'll create a wrapper handler that
+ // selects the appropriate sechandler as needed, for instance choosing the
+ // mac keyring handler, with fallback to the basic sechandler
+ gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
+
+ // initialize all SecAPIHandlers
+ LLProtectedDataException ex = LLProtectedDataException("");
+ std::map<std::string, LLPointer<LLSecAPIHandler> >::const_iterator itr;
+ for(itr = gHandlerMap.begin(); itr != gHandlerMap.end(); ++itr)
+ {
+ LLPointer<LLSecAPIHandler> handler = (*itr).second;
+ try
+ {
+ handler->init();
+ }
+ catch (LLProtectedDataException e)
+ {
+ ex = e;
+ }
+ }
+ if (ex.getMessage().length() > 0 ) // an exception was thrown.
+ {
+ throw ex;
+ }
+
+}
+// start using a given security api handler. If the string is empty
+// the default is used
+LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type)
+{
+ if (gHandlerMap.find(handler_type) != gHandlerMap.end())
+ {
+ return gHandlerMap[handler_type];
+ }
+ else
+ {
+ return LLPointer<LLSecAPIHandler>(NULL);
+ }
+}
+// register a handler
+void registerSecHandler(const std::string& handler_type,
+ LLPointer<LLSecAPIHandler>& handler)
+{
+ gHandlerMap[handler_type] = handler;
+}
+
+std::ostream& operator <<(std::ostream& s, const LLCredential& cred)
+{
+ return s << (std::string)cred;
+}
+
+
+// secapiSSLCertVerifyCallback
+// basic callback called when a cert verification is requested.
+// calls SECAPI to validate the context
+// not initialized in the above initialization function, due to unit tests
+// see llappviewer
+
+int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
+{
+ LLURLRequest *req = (LLURLRequest *)param;
+ LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore("");
+ LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx);
+ LLSD validation_params = LLSD::emptyMap();
+ LLURI uri(req->getURL());
+ validation_params[CERT_HOSTNAME] = uri.hostName();
+ try
+ {
+ chain->validate(VALIDATION_POLICY_SSL, store, validation_params);
+ }
+ catch (LLCertValidationTrustException& cert_exception)
+ {
+ LL_WARNS("AppInit") << "Cert not trusted: " << cert_exception.getMessage() << LL_ENDL;
+ return 0;
+ }
+ catch (LLCertException& cert_exception)
+ {
+ LL_WARNS("AppInit") << "cert error " << cert_exception.getMessage() << LL_ENDL;
+ return 0;
+ }
+ catch (...)
+ {
+ LL_WARNS("AppInit") << "cert error " << LL_ENDL;
+ return 0;
+ }
+ return 1;
+}
+
+LLSD LLCredential::getLoginParams()
+{
+ LLSD result = LLSD::emptyMap();
+ try
+ {
+ if (mIdentifier["type"].asString() == "agent")
+ {
+ // legacy credential
+ result["passwd"] = "$1$" + mAuthenticator["secret"].asString();
+ result["first"] = mIdentifier["first_name"];
+ result["last"] = mIdentifier["last_name"];
+
+ }
+ else if (mIdentifier["type"].asString() == "account")
+ {
+ result["username"] = mIdentifier["account_name"];
+ result["passwd"] = mAuthenticator["secret"];
+
+ }
+ }
+ catch (...)
+ {
+ // we could have corrupt data, so simply return a null login param if so
+ LL_WARNS("AppInit") << "Invalid credential" << LL_ENDL;
+ }
+ return result;
+}
+
+void LLCredential::identifierType(std::string &idType)
+{
+ if(mIdentifier.has("type"))
+ {
+ idType = mIdentifier["type"].asString();
+ }
+ else {
+ idType = std::string();
+
+ }
+}
+
+void LLCredential::authenticatorType(std::string &idType)
+{
+ if(mAuthenticator.has("type"))
+ {
+ idType = mAuthenticator["type"].asString();
+ }
+ else {
+ idType = std::string();
+
+ }
+}
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
new file mode 100644
index 0000000000..59a1e1eff0
--- /dev/null
+++ b/indra/newview/llsecapi.h
@@ -0,0 +1,499 @@
+/**
+ * @file llsecapi.h
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LLSECAPI_H
+#define LLSECAPI_H
+#include <vector>
+#include <openssl/x509.h>
+#include <ostream>
+
+#ifdef LL_WINDOWS
+#pragma warning(disable:4250)
+#endif // LL_WINDOWS
+
+// All error handling is via exceptions.
+
+
+#define CERT_SUBJECT_NAME "subject_name"
+#define CERT_ISSUER_NAME "issuer_name"
+#define CERT_NAME_CN "commonName"
+
+#define CERT_SUBJECT_NAME_STRING "subject_name_string"
+#define CERT_ISSUER_NAME_STRING "issuer_name_string"
+
+#define CERT_SERIAL_NUMBER "serial_number"
+
+#define CERT_VALID_FROM "valid_from"
+#define CERT_VALID_TO "valid_to"
+#define CERT_SHA1_DIGEST "sha1_digest"
+#define CERT_MD5_DIGEST "md5_digest"
+#define CERT_HOSTNAME "hostname"
+#define CERT_BASIC_CONSTRAINTS "basicConstraints"
+#define CERT_BASIC_CONSTRAINTS_CA "CA"
+#define CERT_BASIC_CONSTRAINTS_PATHLEN "pathLen"
+
+#define CERT_KEY_USAGE "keyUsage"
+#define CERT_KU_DIGITAL_SIGNATURE "digitalSignature"
+#define CERT_KU_NON_REPUDIATION "nonRepudiation"
+#define CERT_KU_KEY_ENCIPHERMENT "keyEncipherment"
+#define CERT_KU_DATA_ENCIPHERMENT "dataEncipherment"
+#define CERT_KU_KEY_AGREEMENT "keyAgreement"
+#define CERT_KU_CERT_SIGN "certSigning"
+#define CERT_KU_CRL_SIGN "crlSigning"
+#define CERT_KU_ENCIPHER_ONLY "encipherOnly"
+#define CERT_KU_DECIPHER_ONLY "decipherOnly"
+
+#define BASIC_SECHANDLER "BASIC_SECHANDLER"
+#define CERT_VALIDATION_DATE "validation_date"
+
+#define CERT_EXTENDED_KEY_USAGE "extendedKeyUsage"
+#define CERT_EKU_SERVER_AUTH SN_server_auth
+
+#define CERT_SUBJECT_KEY_IDENTFIER "subjectKeyIdentifier"
+#define CERT_AUTHORITY_KEY_IDENTIFIER "authorityKeyIdentifier"
+#define CERT_AUTHORITY_KEY_IDENTIFIER_ID "authorityKeyIdentifierId"
+#define CERT_AUTHORITY_KEY_IDENTIFIER_NAME "authorityKeyIdentifierName"
+#define CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL "authorityKeyIdentifierSerial"
+
+// validate the current time lies within
+// the validation period of the cert
+#define VALIDATION_POLICY_TIME 1
+
+// validate that the CA, or some cert in the chain
+// lies within the certificate store
+#define VALIDATION_POLICY_TRUSTED 2
+
+// validate that the subject name of
+// the cert contains the passed in hostname
+// or validates against the hostname
+#define VALIDATION_POLICY_HOSTNAME 4
+
+
+// validate that the cert contains the SSL EKU
+#define VALIDATION_POLICY_SSL_KU 8
+
+// validate that the cert contains the SSL EKU
+#define VALIDATION_POLICY_CA_KU 16
+
+#define VALIDATION_POLICY_CA_BASIC_CONSTRAINTS 32
+
+// validate that the cert is correct for SSL
+#define VALIDATION_POLICY_SSL (VALIDATION_POLICY_TIME | \
+ VALIDATION_POLICY_HOSTNAME | \
+ VALIDATION_POLICY_TRUSTED | \
+ VALIDATION_POLICY_SSL_KU | \
+ VALIDATION_POLICY_CA_BASIC_CONSTRAINTS | \
+ VALIDATION_POLICY_CA_KU)
+
+
+
+
+
+
+class LLProtectedDataException
+{
+public:
+ LLProtectedDataException(const char *msg)
+ {
+ LL_WARNS("SECAPI") << "Protected Data Error: " << (std::string)msg << LL_ENDL;
+ mMsg = (std::string)msg;
+ }
+ std::string getMessage() { return mMsg; }
+protected:
+ std::string mMsg;
+};
+
+// class LLCertificate
+// parent class providing an interface for certifiate.
+// LLCertificates are considered unmodifiable
+// Certificates are pulled out of stores, or created via
+// factory calls
+class LLCertificate : public LLRefCount
+{
+ LOG_CLASS(LLCertificate);
+public:
+ LLCertificate() {}
+
+ virtual ~LLCertificate() {}
+
+ // return a PEM encoded certificate. The encoding
+ // includes the -----BEGIN CERTIFICATE----- and end certificate elements
+ virtual std::string getPem() const=0;
+
+ // return a DER encoded certificate
+ virtual std::vector<U8> getBinary() const=0;
+
+ // return an LLSD object containing information about the certificate
+ // such as its name, signature, expiry time, serial number
+ virtual LLSD getLLSD() const=0;
+
+ // return an openSSL X509 struct for the certificate
+ virtual X509* getOpenSSLX509() const=0;
+
+};
+
+// class LLCertificateVector
+// base class for a list of certificates.
+
+
+class LLCertificateVector : public LLRefCount
+{
+
+public:
+
+ LLCertificateVector() {};
+ virtual ~LLCertificateVector() {};
+
+ // base iterator implementation class, providing
+ // the functionality needed for the iterator class.
+ class iterator_impl : public LLRefCount
+ {
+ public:
+ iterator_impl() {};
+ virtual ~iterator_impl() {};
+ virtual void seek(bool incr)=0;
+ virtual LLPointer<iterator_impl> clone() const=0;
+ virtual bool equals(const LLPointer<iterator_impl>& _iter) const=0;
+ virtual LLPointer<LLCertificate> get()=0;
+ };
+
+ // iterator class
+ class iterator
+ {
+ public:
+ iterator(LLPointer<iterator_impl> impl) : mImpl(impl) {}
+ iterator() : mImpl(NULL) {}
+ iterator(const iterator& _iter) {mImpl = _iter.mImpl->clone(); }
+ ~iterator() {}
+ iterator& operator++() { if(mImpl.notNull()) mImpl->seek(true); return *this;}
+ iterator& operator--() { if(mImpl.notNull()) mImpl->seek(false); return *this;}
+
+ iterator operator++(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(true); return result;}
+ iterator operator--(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(false); return result;}
+ LLPointer<LLCertificate> operator*() { return mImpl->get(); }
+
+ LLPointer<iterator_impl> mImpl;
+ protected:
+ friend bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs);
+ bool equals(const iterator& _iter) const { return mImpl->equals(_iter.mImpl); }
+ };
+
+ // numeric indexer
+ virtual LLPointer<LLCertificate> operator[](int)=0;
+
+ // Iteration
+ virtual iterator begin()=0;
+
+ virtual iterator end()=0;
+
+ // find a cert given params
+ virtual iterator find(const LLSD& params) =0;
+
+ // return the number of certs in the store
+ virtual int size() const = 0;
+
+ // append the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void add(LLPointer<LLCertificate> cert)=0;
+
+ // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void insert(iterator location, LLPointer<LLCertificate> cert)=0;
+
+ // remove a certificate from the store
+ virtual LLPointer<LLCertificate> erase(iterator cert)=0;
+};
+
+
+// class LLCertificateStore
+// represents a store of certificates, typically a store of root CA
+// certificates. The store can be persisted, and can be used to validate
+// a cert chain
+//
+class LLCertificateStore : virtual public LLCertificateVector
+{
+
+public:
+
+ LLCertificateStore() {}
+ virtual ~LLCertificateStore() {}
+
+ // persist the store
+ virtual void save()=0;
+
+ // return the store id
+ virtual std::string storeId() const=0;
+};
+
+// class LLCertificateChain
+// Class representing a chain of certificates in order, with the
+// first element being the child cert.
+class LLCertificateChain : virtual public LLCertificateVector
+{
+
+public:
+ LLCertificateChain() {}
+
+ virtual ~LLCertificateChain() {}
+
+ // validate a certificate chain given the params.
+ // Will throw exceptions on error
+
+ virtual void validate(int validation_policy,
+ LLPointer<LLCertificateStore> ca_store,
+ const LLSD& validation_params) =0;
+};
+
+
+
+
+inline
+bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
+{
+ return _lhs.equals(_rhs);
+}
+inline
+bool operator!=(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
+{
+ return !(_lhs == _rhs);
+}
+
+
+#define CRED_IDENTIFIER_TYPE_ACCOUNT "account"
+#define CRED_IDENTIFIER_TYPE_AGENT "agent"
+#define CRED_AUTHENTICATOR_TYPE_CLEAR "clear"
+#define CRED_AUTHENTICATOR_TYPE_HASH "hash"
+//
+// LLCredential - interface for credentials providing the following functionality:
+// * persistance of credential information based on grid (for saving username/password)
+// * serialization to an OGP identifier/authenticator pair
+//
+class LLCredential : public LLRefCount
+{
+public:
+
+ LLCredential() {}
+
+ LLCredential(const std::string& grid)
+ {
+ mGrid = grid;
+ mIdentifier = LLSD::emptyMap();
+ mAuthenticator = LLSD::emptyMap();
+ }
+
+ virtual ~LLCredential() {}
+
+ virtual void setCredentialData(const LLSD& identifier, const LLSD& authenticator)
+ {
+ mIdentifier = identifier;
+ mAuthenticator = authenticator;
+ }
+ virtual LLSD getIdentifier() { return mIdentifier; }
+ virtual void identifierType(std::string& idType);
+ virtual LLSD getAuthenticator() { return mAuthenticator; }
+ virtual void authenticatorType(std::string& authType);
+ virtual LLSD getLoginParams();
+ virtual std::string getGrid() { return mGrid; }
+
+
+ virtual void clearAuthenticator() { mAuthenticator = LLSD(); }
+ virtual std::string userID() const { return std::string("unknown");}
+ virtual std::string asString() const { return std::string("unknown");}
+ operator std::string() const { return asString(); }
+protected:
+ LLSD mIdentifier;
+ LLSD mAuthenticator;
+ std::string mGrid;
+};
+
+std::ostream& operator <<(std::ostream& s, const LLCredential& cred);
+
+
+// All error handling is via exceptions.
+
+class LLCertException
+{
+public:
+ LLCertException(LLPointer<LLCertificate> cert, const char* msg)
+ {
+
+ mCert = cert;
+
+ LL_WARNS("SECAPI") << "Certificate Error: " << (std::string)msg << LL_ENDL;
+ mMsg = (std::string)msg;
+ }
+ LLPointer<LLCertificate> getCert() { return mCert; }
+ std::string getMessage() { return mMsg; }
+protected:
+ LLPointer<LLCertificate> mCert;
+ std::string mMsg;
+};
+
+class LLInvalidCertificate : public LLCertException
+{
+public:
+ LLInvalidCertificate(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalid")
+ {
+ }
+protected:
+};
+
+class LLCertValidationTrustException : public LLCertException
+{
+public:
+ LLCertValidationTrustException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertUntrusted")
+ {
+ }
+protected:
+};
+
+class LLCertValidationHostnameException : public LLCertException
+{
+public:
+ LLCertValidationHostnameException(std::string hostname,
+ LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalidHostname")
+ {
+ mHostname = hostname;
+ }
+
+ std::string getHostname() { return mHostname; }
+protected:
+ std::string mHostname;
+};
+
+class LLCertValidationExpirationException : public LLCertException
+{
+public:
+ LLCertValidationExpirationException(LLPointer<LLCertificate> cert,
+ LLDate current_time) : LLCertException(cert, "CertExpired")
+ {
+ mTime = current_time;
+ }
+ LLDate GetTime() { return mTime; }
+protected:
+ LLDate mTime;
+};
+
+class LLCertKeyUsageValidationException : public LLCertException
+{
+public:
+ LLCertKeyUsageValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertKeyUsage")
+ {
+ }
+protected:
+};
+
+class LLCertBasicConstraintsValidationException : public LLCertException
+{
+public:
+ LLCertBasicConstraintsValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertBasicConstraints")
+ {
+ }
+protected:
+};
+
+class LLCertValidationInvalidSignatureException : public LLCertException
+{
+public:
+ LLCertValidationInvalidSignatureException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalidSignature")
+ {
+ }
+protected:
+};
+
+// LLSecAPIHandler Class
+// Interface handler class for the various security storage handlers.
+class LLSecAPIHandler : public LLRefCount
+{
+public:
+
+
+ LLSecAPIHandler() {}
+ virtual ~LLSecAPIHandler() {}
+
+ // initialize the SecAPIHandler
+ virtual void init() {};
+
+ // instantiate a certificate from a pem string
+ virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert)=0;
+
+
+
+ // instiate a certificate from an openssl X509 structure
+ virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert)=0;
+
+ // instantiate a chain from an X509_STORE_CTX
+ virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain)=0;
+
+ // instantiate a cert store given it's id. if a persisted version
+ // exists, it'll be loaded. If not, one will be created (but not
+ // persisted)
+ virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id)=0;
+
+ // persist data in a protected store
+ virtual void setProtectedData(const std::string& data_type,
+ const std::string& data_id,
+ const LLSD& data)=0;
+
+ // retrieve protected data
+ virtual LLSD getProtectedData(const std::string& data_type,
+ const std::string& data_id)=0;
+
+ // delete a protected data item from the store
+ virtual void deleteProtectedData(const std::string& data_type,
+ const std::string& data_id)=0;
+
+ virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+ const LLSD& identifier,
+ const LLSD& authenticator)=0;
+
+ virtual LLPointer<LLCredential> loadCredential(const std::string& grid)=0;
+
+ virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)=0;
+
+ virtual void deleteCredential(LLPointer<LLCredential> cred)=0;
+
+};
+
+void initializeSecHandler();
+
+// retrieve a security api depending on the api type
+LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type);
+
+void registerSecHandler(const std::string& handler_type,
+ LLPointer<LLSecAPIHandler>& handler);
+
+extern LLPointer<LLSecAPIHandler> gSecAPIHandler;
+
+
+int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param);
+
+
+#endif // LL_SECAPI_H
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
new file mode 100644
index 0000000000..df55ccf142
--- /dev/null
+++ b/indra/newview/llsechandler_basic.cpp
@@ -0,0 +1,1612 @@
+/**
+ * @file llsechandler_basic.cpp
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ *
+ * Copyright (c) 2003-2000, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+LLS * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+#include "llsecapi.h"
+#include "llsechandler_basic.h"
+#include "llsdserialize.h"
+#include "llviewernetwork.h"
+#include "llxorcipher.h"
+#include "llfile.h"
+#include "lldir.h"
+#include "llviewercontrol.h"
+#include <vector>
+#include <ios>
+#include <openssl/ossl_typ.h>
+#include <openssl/x509.h>
+#include <openssl/x509v3.h>
+#include <openssl/pem.h>
+#include <openssl/asn1.h>
+#include <openssl/rand.h>
+#include <openssl/err.h>
+#include <iostream>
+#include <iomanip>
+#include <time.h>
+
+
+
+// 128 bits of salt data...
+#define STORE_SALT_SIZE 16
+#define BUFFER_READ_SIZE 256
+std::string cert_string_from_asn1_string(ASN1_STRING* value);
+std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value);
+
+LLSD _basic_constraints_ext(X509* cert);
+LLSD _key_usage_ext(X509* cert);
+LLSD _ext_key_usage_ext(X509* cert);
+LLSD _subject_key_identifier_ext(X509 *cert);
+LLSD _authority_key_identifier_ext(X509* cert);
+
+LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert)
+{
+
+ // BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const
+ // so we need to cast it.
+ BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length());
+ if(pem_bio == NULL)
+ {
+ LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+ throw LLInvalidCertificate(this);
+ }
+ mCert = NULL;
+ PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
+ BIO_free(pem_bio);
+ if (!mCert)
+ {
+ throw LLInvalidCertificate(this);
+ }
+ _initLLSD();
+}
+
+
+LLBasicCertificate::LLBasicCertificate(X509* pCert)
+{
+ if (!pCert || !pCert->cert_info)
+ {
+ throw LLInvalidCertificate(this);
+ }
+ mCert = X509_dup(pCert);
+ _initLLSD();
+}
+
+LLBasicCertificate::~LLBasicCertificate()
+{
+ if(mCert)
+ {
+ X509_free(mCert);
+ }
+}
+
+//
+// retrieve the pem using the openssl functionality
+std::string LLBasicCertificate::getPem() const
+{
+ char * pem_bio_chars = NULL;
+ // a BIO is the equivalent of a 'std::stream', and
+ // can be a file, mem stream, whatever. Grab a memory based
+ // BIO for the result
+ BIO *pem_bio = BIO_new(BIO_s_mem());
+ if (!pem_bio)
+ {
+ LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+ return std::string();
+ }
+ PEM_write_bio_X509(pem_bio, mCert);
+ int length = BIO_get_mem_data(pem_bio, &pem_bio_chars);
+ std::string result = std::string(pem_bio_chars, length);
+ BIO_free(pem_bio);
+ return result;
+}
+
+// get the DER encoding for the cert
+// DER is a binary encoding format for certs...
+std::vector<U8> LLBasicCertificate::getBinary() const
+{
+ U8 * der_bio_data = NULL;
+ // get a memory bio
+ BIO *der_bio = BIO_new(BIO_s_mem());
+ if (!der_bio)
+ {
+ LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+ return std::vector<U8>();
+ }
+ i2d_X509_bio(der_bio, mCert);
+ int length = BIO_get_mem_data(der_bio, &der_bio_data);
+ std::vector<U8> result(length);
+ // vectors are guranteed to be a contiguous chunk of memory.
+ memcpy(&result[0], der_bio_data, length);
+ BIO_free(der_bio);
+ return result;
+}
+
+
+LLSD LLBasicCertificate::getLLSD() const
+{
+ return mLLSDInfo;
+}
+
+// Initialize the LLSD info for the certificate
+LLSD& LLBasicCertificate::_initLLSD()
+{
+
+ // call the various helpers to build the LLSD
+ mLLSDInfo[CERT_SUBJECT_NAME] = cert_name_from_X509_NAME(X509_get_subject_name(mCert));
+ mLLSDInfo[CERT_ISSUER_NAME] = cert_name_from_X509_NAME(X509_get_issuer_name(mCert));
+ mLLSDInfo[CERT_SUBJECT_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_subject_name(mCert));
+ mLLSDInfo[CERT_ISSUER_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_issuer_name(mCert));
+ ASN1_INTEGER *sn = X509_get_serialNumber(mCert);
+ if (sn != NULL)
+ {
+ mLLSDInfo[CERT_SERIAL_NUMBER] = cert_string_from_asn1_integer(sn);
+ }
+
+ mLLSDInfo[CERT_VALID_TO] = cert_date_from_asn1_time(X509_get_notAfter(mCert));
+ mLLSDInfo[CERT_VALID_FROM] = cert_date_from_asn1_time(X509_get_notBefore(mCert));
+ mLLSDInfo[CERT_SHA1_DIGEST] = cert_get_digest("sha1", mCert);
+ mLLSDInfo[CERT_MD5_DIGEST] = cert_get_digest("md5", mCert);
+ // add the known extensions
+ mLLSDInfo[CERT_BASIC_CONSTRAINTS] = _basic_constraints_ext(mCert);
+ mLLSDInfo[CERT_KEY_USAGE] = _key_usage_ext(mCert);
+ mLLSDInfo[CERT_EXTENDED_KEY_USAGE] = _ext_key_usage_ext(mCert);
+ mLLSDInfo[CERT_SUBJECT_KEY_IDENTFIER] = _subject_key_identifier_ext(mCert);
+ mLLSDInfo[CERT_AUTHORITY_KEY_IDENTIFIER] = _authority_key_identifier_ext(mCert);
+ return mLLSDInfo;
+}
+
+// Retrieve the basic constraints info
+LLSD _basic_constraints_ext(X509* cert)
+{
+ LLSD result;
+ BASIC_CONSTRAINTS *bs = (BASIC_CONSTRAINTS *)X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL);
+ if(bs)
+ {
+ result = LLSD::emptyMap();
+ // Determines whether the cert can be used as a CA
+ result[CERT_BASIC_CONSTRAINTS_CA] = (bool)bs->ca;
+
+ if(bs->pathlen)
+ {
+ // the pathlen determines how deep a certificate chain can be from
+ // this CA
+ if((bs->pathlen->type == V_ASN1_NEG_INTEGER)
+ || !bs->ca)
+ {
+ result[CERT_BASIC_CONSTRAINTS_PATHLEN] = 0;
+ }
+ else
+ {
+ result[CERT_BASIC_CONSTRAINTS_PATHLEN] = (int)ASN1_INTEGER_get(bs->pathlen);
+ }
+ }
+
+ }
+ return result;
+}
+
+// retrieve the key usage, which specifies how the cert can be used.
+//
+LLSD _key_usage_ext(X509* cert)
+{
+ LLSD result;
+ ASN1_STRING *usage_str = (ASN1_STRING *)X509_get_ext_d2i(cert, NID_key_usage, NULL, NULL);
+ if(usage_str)
+ {
+ result = LLSD::emptyArray();
+ long usage = 0;
+ if(usage_str->length > 0)
+ {
+ usage = usage_str->data[0];
+ if(usage_str->length > 1)
+ {
+ usage |= usage_str->data[1] << 8;
+ }
+ }
+ ASN1_STRING_free(usage_str);
+ if(usage)
+ {
+ if(usage & KU_DIGITAL_SIGNATURE) result.append(LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE));
+ if(usage & KU_NON_REPUDIATION) result.append(LLSD((std::string)CERT_KU_NON_REPUDIATION));
+ if(usage & KU_KEY_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT));
+ if(usage & KU_DATA_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_DATA_ENCIPHERMENT));
+ if(usage & KU_KEY_AGREEMENT) result.append(LLSD((std::string)CERT_KU_KEY_AGREEMENT));
+ if(usage & KU_KEY_CERT_SIGN) result.append(LLSD((std::string)CERT_KU_CERT_SIGN));
+ if(usage & KU_CRL_SIGN) result.append(LLSD((std::string)CERT_KU_CRL_SIGN));
+ if(usage & KU_ENCIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_ENCIPHER_ONLY));
+ if(usage & KU_DECIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_DECIPHER_ONLY));
+ }
+ }
+ return result;
+}
+
+// retrieve the extended key usage for the cert
+LLSD _ext_key_usage_ext(X509* cert)
+{
+ LLSD result;
+ EXTENDED_KEY_USAGE *eku = (EXTENDED_KEY_USAGE *)X509_get_ext_d2i(cert, NID_ext_key_usage, NULL, NULL);
+ if(eku)
+ {
+ result = LLSD::emptyArray();
+ while(sk_ASN1_OBJECT_num(eku))
+ {
+ ASN1_OBJECT *usage = sk_ASN1_OBJECT_pop(eku);
+ if(usage)
+ {
+ int nid = OBJ_obj2nid(usage);
+ if (nid)
+ {
+ std::string sn = OBJ_nid2sn(nid);
+ result.append(sn);
+ }
+ ASN1_OBJECT_free(usage);
+ }
+ }
+ }
+ return result;
+}
+
+// retrieve the subject key identifier of the cert
+LLSD _subject_key_identifier_ext(X509 *cert)
+{
+ LLSD result;
+ ASN1_OCTET_STRING *skeyid = (ASN1_OCTET_STRING *)X509_get_ext_d2i(cert, NID_subject_key_identifier, NULL, NULL);
+ if(skeyid)
+ {
+ result = cert_string_from_octet_string(skeyid);
+ }
+ return result;
+}
+
+// retrieve the authority key identifier of the cert
+LLSD _authority_key_identifier_ext(X509* cert)
+{
+ LLSD result;
+ AUTHORITY_KEYID *akeyid = (AUTHORITY_KEYID *)X509_get_ext_d2i(cert, NID_authority_key_identifier, NULL, NULL);
+ if(akeyid)
+ {
+ result = LLSD::emptyMap();
+ if(akeyid->keyid)
+ {
+ result[CERT_AUTHORITY_KEY_IDENTIFIER_ID] = cert_string_from_octet_string(akeyid->keyid);
+ }
+ if(akeyid->serial)
+ {
+ result[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL] = cert_string_from_asn1_integer(akeyid->serial);
+ }
+ }
+
+ // we ignore the issuer name in the authority key identifier, we check the issue name via
+ // the the issuer name entry in the cert.
+
+
+ return result;
+}
+
+// retrieve an openssl x509 object,
+// which must be freed by X509_free
+X509* LLBasicCertificate::getOpenSSLX509() const
+{
+ return X509_dup(mCert);
+}
+
+// generate a single string containing the subject or issuer
+// name of the cert.
+std::string cert_string_name_from_X509_NAME(X509_NAME* name)
+{
+ char * name_bio_chars = NULL;
+ // get a memory bio
+ BIO *name_bio = BIO_new(BIO_s_mem());
+ // stream the name into the bio. The name will be in the 'short name' format
+ X509_NAME_print_ex(name_bio, name, 0, XN_FLAG_RFC2253);
+ int length = BIO_get_mem_data(name_bio, &name_bio_chars);
+ std::string result = std::string(name_bio_chars, length);
+ BIO_free(name_bio);
+ return result;
+}
+
+// generate an LLSD from a certificate name (issuer or subject name).
+// the name will be strings indexed by the 'long form'
+LLSD cert_name_from_X509_NAME(X509_NAME* name)
+{
+ LLSD result = LLSD::emptyMap();
+ int name_entries = X509_NAME_entry_count(name);
+ for (int entry_index=0; entry_index < name_entries; entry_index++)
+ {
+ char buffer[32];
+ X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, entry_index);
+
+ std::string name_value = std::string((const char*)M_ASN1_STRING_data(X509_NAME_ENTRY_get_data(entry)),
+ M_ASN1_STRING_length(X509_NAME_ENTRY_get_data(entry)));
+
+ ASN1_OBJECT* name_obj = X509_NAME_ENTRY_get_object(entry);
+ OBJ_obj2txt(buffer, sizeof(buffer), name_obj, 0);
+ std::string obj_buffer_str = std::string(buffer);
+ result[obj_buffer_str] = name_value;
+ }
+
+ return result;
+}
+
+// Generate a string from an ASN1 integer. ASN1 Integers are
+// bignums, so they can be 'infinitely' long, therefore we
+// cannot simply use a conversion to U64 or something.
+// We retrieve as a readable string for UI
+
+std::string cert_string_from_asn1_integer(ASN1_INTEGER* value)
+{
+ std::string result;
+ BIGNUM *bn = ASN1_INTEGER_to_BN(value, NULL);
+ if(bn)
+ {
+ char * ascii_bn = BN_bn2hex(bn);
+
+ if(ascii_bn)
+ {
+ result = ascii_bn;
+ OPENSSL_free(ascii_bn);
+ }
+ BN_free(bn);
+ }
+ return result;
+}
+
+// Generate a string from an OCTET string.
+// we retrieve as a
+
+std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value)
+{
+
+ std::stringstream result;
+ result << std::hex << std::setprecision(2);
+ for (int i=0; i < value->length; i++)
+ {
+ if (i != 0)
+ {
+ result << ":";
+ }
+ result << std::setfill('0') << std::setw(2) << (int)value->data[i];
+ }
+ return result.str();
+}
+
+// Generate a string from an ASN1 integer. ASN1 Integers are
+// bignums, so they can be 'infinitely' long, therefore we
+// cannot simply use a conversion to U64 or something.
+// We retrieve as a readable string for UI
+
+std::string cert_string_from_asn1_string(ASN1_STRING* value)
+{
+ char * string_bio_chars = NULL;
+ std::string result;
+ // get a memory bio
+ BIO *string_bio = BIO_new(BIO_s_mem());
+ if(!string_bio)
+ {
+ // stream the name into the bio. The name will be in the 'short name' format
+ ASN1_STRING_print_ex(string_bio, value, ASN1_STRFLGS_RFC2253);
+ int length = BIO_get_mem_data(string_bio, &string_bio_chars);
+ result = std::string(string_bio_chars, length);
+ BIO_free(string_bio);
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+ }
+
+ return result;
+}
+
+// retrieve a date structure from an ASN1 time, for
+// validity checking.
+LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time)
+{
+
+ struct tm timestruct = {0};
+ int i = asn1_time->length;
+
+ if (i < 10)
+ {
+ return LLDate();
+ }
+ // convert the date from the ASN1 time (which is a string in ZULU time), to
+ // a timeval.
+ timestruct.tm_year = (asn1_time->data[0]-'0') * 10 + (asn1_time->data[1]-'0');
+
+ /* Deal with Year 2000 */
+ if (timestruct.tm_year < 70)
+ timestruct.tm_year += 100;
+
+ timestruct.tm_mon = (asn1_time->data[2]-'0') * 10 + (asn1_time->data[3]-'0') - 1;
+ timestruct.tm_mday = (asn1_time->data[4]-'0') * 10 + (asn1_time->data[5]-'0');
+ timestruct.tm_hour = (asn1_time->data[6]-'0') * 10 + (asn1_time->data[7]-'0');
+ timestruct.tm_min = (asn1_time->data[8]-'0') * 10 + (asn1_time->data[9]-'0');
+ timestruct.tm_sec = (asn1_time->data[10]-'0') * 10 + (asn1_time->data[11]-'0');
+
+#if LL_WINDOWS
+ return LLDate((F64)_mkgmtime(&timestruct));
+#else // LL_WINDOWS
+ return LLDate((F64)timegm(&timestruct));
+#endif // LL_WINDOWS
+}
+
+
+// Generate a string containing a digest. The digest time is 'ssh1' or
+// 'md5', and the resulting string is of the form "aa:12:5c:' and so on
+std::string cert_get_digest(const std::string& digest_type, X509 *cert)
+{
+ unsigned char digest_data[BUFFER_READ_SIZE];
+ unsigned int len = sizeof(digest_data);
+ std::stringstream result;
+ const EVP_MD* digest = NULL;
+ // we could use EVP_get_digestbyname, but that requires initializer code which
+ // would require us to complicate things by plumbing it into the system.
+ if (digest_type == "md5")
+ {
+ digest = EVP_md5();
+ }
+ else if (digest_type == "sha1")
+ {
+ digest = EVP_sha1();
+ }
+ else
+ {
+ return std::string();
+ }
+
+ X509_digest(cert, digest, digest_data, &len);
+ result << std::hex << std::setprecision(2);
+ for (unsigned int i=0; i < len; i++)
+ {
+ if (i != 0)
+ {
+ result << ":";
+ }
+ result << std::setfill('0') << std::setw(2) << (int)digest_data[i];
+ }
+ return result.str();
+}
+
+
+// class LLBasicCertificateVector
+// This class represents a list of certificates, implemented by a vector of certificate pointers.
+// it contains implementations of the virtual functions for iterators, search, add, remove, etc.
+//
+
+// Find a certificate in the list.
+// It will find a cert that has minimally the params listed, with the values being the same
+LLBasicCertificateVector::iterator LLBasicCertificateVector::find(const LLSD& params)
+{
+ BOOL found = FALSE;
+ // loop through the entire vector comparing the values in the certs
+ // against those passed in via the params.
+ // params should be a map. Only the items specified in the map will be
+ // checked, but they must match exactly, even if they're maps or arrays.
+
+ for(iterator cert = begin();
+ cert != end();
+ cert++)
+ {
+
+ found= TRUE;
+ LLSD cert_info = (*cert)->getLLSD();
+ for (LLSD::map_const_iterator param = params.beginMap();
+ param != params.endMap();
+ param++)
+ {
+
+ if (!cert_info.has((std::string)param->first) ||
+ (!valueCompareLLSD(cert_info[(std::string)param->first], param->second)))
+ {
+ found = FALSE;
+ break;
+ }
+ }
+ if (found)
+ {
+ return (cert);
+ }
+ }
+ return end();
+}
+
+// Insert a certificate into the store. If the certificate already
+// exists in the store, nothing is done.
+void LLBasicCertificateVector::insert(iterator _iter,
+ LLPointer<LLCertificate> cert)
+{
+ LLSD cert_info = cert->getLLSD();
+ if (cert_info.isMap() && cert_info.has(CERT_SHA1_DIGEST))
+ {
+ LLSD existing_cert_info = LLSD::emptyMap();
+ existing_cert_info[CERT_MD5_DIGEST] = cert_info[CERT_MD5_DIGEST];
+ if(find(existing_cert_info) == end())
+ {
+ BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
+ mCerts.insert(basic_iter->mIter, cert);
+ }
+ }
+}
+
+// remove a certificate from the store
+LLPointer<LLCertificate> LLBasicCertificateVector::erase(iterator _iter)
+{
+
+ if (_iter != end())
+ {
+ BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
+ LLPointer<LLCertificate> result = (*_iter);
+ mCerts.erase(basic_iter->mIter);
+ return result;
+ }
+ return NULL;
+}
+
+
+//
+// LLBasicCertificateStore
+// This class represents a store of CA certificates. The basic implementation
+// uses a pem file such as the legacy CA.pem stored in the existing
+// SL implementation.
+LLBasicCertificateStore::LLBasicCertificateStore(const std::string& filename)
+{
+ mFilename = filename;
+ load_from_file(filename);
+}
+
+void LLBasicCertificateStore::load_from_file(const std::string& filename)
+{
+ // scan the PEM file extracting each certificate
+ BIO* file_bio = BIO_new(BIO_s_file());
+ if(file_bio)
+ {
+ if (BIO_read_filename(file_bio, filename.c_str()) > 0)
+ {
+ X509 *cert_x509 = NULL;
+ while((PEM_read_bio_X509(file_bio, &cert_x509, 0, NULL)) &&
+ (cert_x509 != NULL))
+ {
+ try
+ {
+ add(new LLBasicCertificate(cert_x509));
+ }
+ catch (...)
+ {
+ LL_WARNS("SECAPI") << "Failure creating certificate from the certificate store file." << LL_ENDL;
+ }
+ X509_free(cert_x509);
+ cert_x509 = NULL;
+ }
+ BIO_free(file_bio);
+ }
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Could not allocate a file BIO" << LL_ENDL;
+ }
+}
+
+
+LLBasicCertificateStore::~LLBasicCertificateStore()
+{
+}
+
+
+// persist the store
+void LLBasicCertificateStore::save()
+{
+ llofstream file_store(mFilename, llofstream::binary);
+ if(!file_store.fail())
+ {
+ for(iterator cert = begin();
+ cert != end();
+ cert++)
+ {
+ std::string pem = (*cert)->getPem();
+ if(!pem.empty())
+ {
+ file_store << (*cert)->getPem() << std::endl;
+ }
+ }
+ file_store.close();
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Could not open certificate store " << mFilename << "for save" << LL_ENDL;
+ }
+}
+
+// return the store id
+std::string LLBasicCertificateStore::storeId() const
+{
+ // this is the basic handler which uses the CA.pem store,
+ // so we ignore this.
+ return std::string("");
+}
+
+
+//
+// LLBasicCertificateChain
+// This class represents a chain of certs, each cert being signed by the next cert
+// in the chain. Certs must be properly signed by the parent
+LLBasicCertificateChain::LLBasicCertificateChain(const X509_STORE_CTX* store)
+{
+
+ // we're passed in a context, which contains a cert, and a blob of untrusted
+ // certificates which compose the chain.
+ if((store == NULL) || (store->cert == NULL))
+ {
+ LL_WARNS("SECAPI") << "An invalid store context was passed in when trying to create a certificate chain" << LL_ENDL;
+ return;
+ }
+ // grab the child cert
+ LLPointer<LLCertificate> current = new LLBasicCertificate(store->cert);
+
+ add(current);
+ if(store->untrusted != NULL)
+ {
+ // if there are other certs in the chain, we build up a vector
+ // of untrusted certs so we can search for the parents of each
+ // consecutive cert.
+ LLBasicCertificateVector untrusted_certs;
+ for(int i = 0; i < sk_X509_num(store->untrusted); i++)
+ {
+ LLPointer<LLCertificate> cert = new LLBasicCertificate(sk_X509_value(store->untrusted, i));
+ untrusted_certs.add(cert);
+
+ }
+ while(untrusted_certs.size() > 0)
+ {
+ LLSD find_data = LLSD::emptyMap();
+ LLSD cert_data = current->getLLSD();
+ // we simply build the chain via subject/issuer name as the
+ // client should not have passed in multiple CA's with the same
+ // subject name. If they did, it'll come out in the wash during
+ // validation.
+ find_data[CERT_SUBJECT_NAME_STRING] = cert_data[CERT_ISSUER_NAME_STRING];
+ LLBasicCertificateVector::iterator issuer = untrusted_certs.find(find_data);
+ if (issuer != untrusted_certs.end())
+ {
+ current = untrusted_certs.erase(issuer);
+ add(current);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+}
+
+
+// subdomain wildcard specifiers can be divided into 3 parts
+// the part before the first *, the part after the first * but before
+// the second *, and the part after the second *.
+// It then iterates over the second for each place in the string
+// that it matches. ie if the subdomain was testfoofoobar, and
+// the wildcard was test*foo*bar, it would match test, then
+// recursively match foofoobar and foobar
+
+bool _cert_subdomain_wildcard_match(const std::string& subdomain,
+ const std::string& wildcard)
+{
+ // split wildcard into the portion before the *, and the portion after
+
+ int wildcard_pos = wildcard.find_first_of('*');
+ // check the case where there is no wildcard.
+ if(wildcard_pos == wildcard.npos)
+ {
+ return (subdomain == wildcard);
+ }
+
+ // we need to match the first part of the subdomain string up to the wildcard
+ // position
+ if(subdomain.substr(0, wildcard_pos) != wildcard.substr(0, wildcard_pos))
+ {
+ // the first portions of the strings didn't match
+ return FALSE;
+ }
+
+ // as the portion of the wildcard string before the * matched, we need to check the
+ // portion afterwards. Grab that portion.
+ std::string new_wildcard_string = wildcard.substr( wildcard_pos+1, wildcard.npos);
+ if(new_wildcard_string.empty())
+ {
+ // we had nothing after the *, so it's an automatic match
+ return TRUE;
+ }
+
+ // grab the portion of the remaining wildcard string before the next '*'. We need to find this
+ // within the remaining subdomain string. and then recursively check.
+ std::string new_wildcard_match_string = new_wildcard_string.substr(0, new_wildcard_string.find_first_of('*'));
+
+ // grab the portion of the subdomain after the part that matched the initial wildcard portion
+ std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos);
+
+ // iterate through the current subdomain, finding instances of the match string.
+ int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string);
+ while(sub_pos != std::string::npos)
+ {
+ new_subdomain = new_subdomain.substr(sub_pos, std::string::npos);
+ if(_cert_subdomain_wildcard_match(new_subdomain, new_wildcard_string))
+ {
+ return TRUE;
+ }
+ sub_pos = new_subdomain.find_first_of(new_wildcard_match_string, 1);
+
+
+ }
+ // didn't find any instances of the match string that worked in the subdomain, so fail.
+ return FALSE;
+}
+
+
+// RFC2459 does not address wildcards as part of it's name matching
+// specification, and there is no RFC specifying wildcard matching,
+// RFC2818 does a few statements about wildcard matching, but is very
+// general. Generally, wildcard matching is per implementation, although
+// it's pretty similar.
+// in our case, we use the '*' wildcard character only, within each
+// subdomain. The hostname and the CN specification should have the
+// same number of subdomains.
+// We then iterate that algorithm over each subdomain.
+bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& common_name)
+{
+ std::string new_hostname = hostname;
+ std::string new_cn = common_name;
+
+ // find the last '.' in the hostname and the match name.
+ int subdomain_pos = new_hostname.find_last_of('.');
+ int subcn_pos = new_cn.find_last_of('.');
+
+ // if the last char is a '.', strip it
+ if(subdomain_pos == (new_hostname.length()-1))
+ {
+ new_hostname = new_hostname.substr(0, subdomain_pos);
+ subdomain_pos = new_hostname.find_last_of('.');
+ }
+ if(subcn_pos == (new_cn.length()-1))
+ {
+ new_cn = new_cn.substr(0, subcn_pos);
+ subcn_pos = new_cn.find_last_of('.');
+ }
+
+ // Check to see if there are any further '.' in the string.
+ while((subcn_pos != std::string::npos) && (subdomain_pos != std::string::npos))
+ {
+ // snip out last subdomain in both the match string and the hostname
+ // The last bit for 'my.current.host.com' would be 'com'
+ std::string cn_part = new_cn.substr(subcn_pos+1, std::string::npos);
+ std::string hostname_part = new_hostname.substr(subdomain_pos+1, std::string::npos);
+
+ if(!_cert_subdomain_wildcard_match(new_hostname.substr(subdomain_pos+1, std::string::npos),
+ cn_part))
+ {
+ return FALSE;
+ }
+ new_hostname = new_hostname.substr(0, subdomain_pos);
+ new_cn = new_cn.substr(0, subcn_pos);
+ subdomain_pos = new_hostname.find_last_of('.');
+ subcn_pos = new_cn.find_last_of('.');
+ }
+ // check to see if the most significant portion of the common name is '*'. If so, we can
+ // simply return success as child domains are also matched.
+ if(new_cn == "*")
+ {
+ // if it's just a '*' we support all child domains as well, so '*.
+ return TRUE;
+ }
+
+ return _cert_subdomain_wildcard_match(new_hostname, new_cn);
+
+}
+
+// validate that the LLSD array in llsd_set contains the llsd_value
+bool _LLSDArrayIncludesValue(const LLSD& llsd_set, LLSD llsd_value)
+{
+ for(LLSD::array_const_iterator set_value = llsd_set.beginArray();
+ set_value != llsd_set.endArray();
+ set_value++)
+ {
+ if(valueCompareLLSD((*set_value), llsd_value))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void _validateCert(int validation_policy,
+ const LLPointer<LLCertificate> cert,
+ const LLSD& validation_params,
+ int depth)
+{
+
+ LLSD current_cert_info = cert->getLLSD();
+ // check basic properties exist in the cert
+ if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info.has(CERT_SUBJECT_NAME_STRING))
+ {
+ throw LLCertException(cert, "Cert doesn't have a Subject Name");
+ }
+
+ if(!current_cert_info.has(CERT_ISSUER_NAME_STRING))
+ {
+ throw LLCertException(cert, "Cert doesn't have an Issuer Name");
+ }
+
+ // check basic properties exist in the cert
+ if(!current_cert_info.has(CERT_VALID_FROM) || !current_cert_info.has(CERT_VALID_TO))
+ {
+ throw LLCertException(cert, "Cert doesn't have an expiration period");
+ }
+ if (!current_cert_info.has(CERT_SHA1_DIGEST))
+ {
+ throw LLCertException(cert, "No SHA1 digest");
+ }
+
+ if (validation_policy & VALIDATION_POLICY_TIME)
+ {
+
+ LLDate validation_date(time(NULL));
+ if(validation_params.has(CERT_VALIDATION_DATE))
+ {
+ validation_date = validation_params[CERT_VALIDATION_DATE];
+ }
+
+ if((validation_date < current_cert_info[CERT_VALID_FROM].asDate()) ||
+ (validation_date > current_cert_info[CERT_VALID_TO].asDate()))
+ {
+ throw LLCertValidationExpirationException(cert, validation_date);
+ }
+ }
+ if (validation_policy & VALIDATION_POLICY_SSL_KU)
+ {
+ if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
+ (!(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
+ LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE))) ||
+ !(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
+ LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT)))))
+ {
+ throw LLCertKeyUsageValidationException(cert);
+ }
+ // only validate EKU if the cert has it
+ if(current_cert_info.has(CERT_EXTENDED_KEY_USAGE) && current_cert_info[CERT_EXTENDED_KEY_USAGE].isArray() &&
+ (!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE],
+ LLSD((std::string)CERT_EKU_SERVER_AUTH))))
+ {
+ throw LLCertKeyUsageValidationException(cert);
+ }
+ }
+ if (validation_policy & VALIDATION_POLICY_CA_KU)
+ {
+ if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
+ (!_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
+ (std::string)CERT_KU_CERT_SIGN)))
+ {
+ throw LLCertKeyUsageValidationException(cert);
+ }
+ }
+
+ // validate basic constraints
+ if ((validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS) &&
+ current_cert_info.has(CERT_BASIC_CONSTRAINTS) &&
+ current_cert_info[CERT_BASIC_CONSTRAINTS].isMap())
+ {
+ if(!current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_CA) ||
+ !current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_CA])
+ {
+ throw LLCertBasicConstraintsValidationException(cert);
+ }
+ if (current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_PATHLEN) &&
+ ((current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger() != 0) &&
+ (depth > current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger())))
+ {
+ throw LLCertBasicConstraintsValidationException(cert);
+ }
+ }
+}
+
+bool _verify_signature(LLPointer<LLCertificate> parent,
+ LLPointer<LLCertificate> child)
+{
+ bool verify_result = FALSE;
+ LLSD cert1 = parent->getLLSD();
+ LLSD cert2 = child->getLLSD();
+ X509 *signing_cert = parent->getOpenSSLX509();
+ X509 *child_cert = child->getOpenSSLX509();
+ if((signing_cert != NULL) && (child_cert != NULL))
+ {
+ EVP_PKEY *pkey = X509_get_pubkey(signing_cert);
+
+
+ if(pkey)
+ {
+ int verify_code = X509_verify(child_cert, pkey);
+ verify_result = ( verify_code > 0);
+ EVP_PKEY_free(pkey);
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Could not validate the cert chain signature, as the public key of the signing cert could not be retrieved" << LL_ENDL;
+ }
+
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Signature verification failed as there are no certs in the chain" << LL_ENDL;
+ }
+ if(child_cert)
+ {
+ X509_free(child_cert);
+ }
+ if(signing_cert)
+ {
+ X509_free(signing_cert);
+ }
+ return verify_result;
+}
+
+// validate the certificate chain against a store.
+// There are many aspects of cert validatioin policy involved in
+// trust validation. The policies in this validation algorithm include
+// * Hostname matching for SSL certs
+// * Expiration time matching
+// * Signature validation
+// * Chain trust (is the cert chain trusted against the store)
+// * Basic constraints
+// * key usage and extended key usage
+// TODO: We should add 'authority key identifier' for chaining.
+// This algorithm doesn't simply validate the chain by itself
+// and verify the last cert is in the certificate store, or points
+// to a cert in the store. It validates whether any cert in the chain
+// is trusted in the store, even if it's not the last one.
+void LLBasicCertificateChain::validate(int validation_policy,
+ LLPointer<LLCertificateStore> ca_store,
+ const LLSD& validation_params)
+{
+
+ if(size() < 1)
+ {
+ throw LLCertException(NULL, "No certs in chain");
+ }
+ iterator current_cert = begin();
+ LLSD current_cert_info = (*current_cert)->getLLSD();
+ LLSD validation_date;
+ if (validation_params.has(CERT_VALIDATION_DATE))
+ {
+ validation_date = validation_params[CERT_VALIDATION_DATE];
+ }
+
+ if (validation_policy & VALIDATION_POLICY_HOSTNAME)
+ {
+ if(!validation_params.has(CERT_HOSTNAME))
+ {
+ throw LLCertException((*current_cert), "No hostname passed in for validation");
+ }
+ if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
+ {
+ throw LLInvalidCertificate((*current_cert));
+ }
+
+ LL_INFOS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() <<
+ "against the cert CN " << current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString() << LL_ENDL;
+ if(!_cert_hostname_wildcard_match(validation_params[CERT_HOSTNAME].asString(),
+ current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString()))
+ {
+ throw LLCertValidationHostnameException(validation_params[CERT_HOSTNAME].asString(),
+ (*current_cert));
+ }
+ }
+
+
+ int depth = 0;
+ LLPointer<LLCertificate> previous_cert;
+ // loop through the cert chain, validating the current cert against the next one.
+ while(current_cert != end())
+ {
+
+ int local_validation_policy = validation_policy;
+ if(current_cert == begin())
+ {
+ // for the child cert, we don't validate CA stuff
+ local_validation_policy &= ~(VALIDATION_POLICY_CA_KU |
+ VALIDATION_POLICY_CA_BASIC_CONSTRAINTS);
+ }
+ else
+ {
+ // for non-child certs, we don't validate SSL Key usage
+ local_validation_policy &= ~VALIDATION_POLICY_SSL_KU;
+ if(!_verify_signature((*current_cert),
+ previous_cert))
+ {
+ throw LLCertValidationInvalidSignatureException(previous_cert);
+ }
+ }
+ _validateCert(local_validation_policy,
+ (*current_cert),
+ validation_params,
+ depth);
+
+ // look for a CA in the CA store that may belong to this chain.
+ LLSD cert_llsd = (*current_cert)->getLLSD();
+ LLSD cert_search_params = LLSD::emptyMap();
+ // is the cert itself in the store?
+ cert_search_params[CERT_SHA1_DIGEST] = cert_llsd[CERT_SHA1_DIGEST];
+ LLCertificateStore::iterator found_store_cert = ca_store->find(cert_search_params);
+ if(found_store_cert != ca_store->end())
+ {
+ return;
+ }
+
+ // is the parent in the cert store?
+
+ cert_search_params = LLSD::emptyMap();
+ cert_search_params[CERT_SUBJECT_NAME_STRING] = cert_llsd[CERT_ISSUER_NAME_STRING];
+ if (cert_llsd.has(CERT_AUTHORITY_KEY_IDENTIFIER))
+ {
+ LLSD cert_aki = cert_llsd[CERT_AUTHORITY_KEY_IDENTIFIER];
+ if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_ID))
+ {
+ cert_search_params[CERT_SUBJECT_KEY_IDENTFIER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_ID];
+ }
+ if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL))
+ {
+ cert_search_params[CERT_SERIAL_NUMBER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL];
+ }
+ }
+ found_store_cert = ca_store->find(cert_search_params);
+
+ if(found_store_cert != ca_store->end())
+ {
+ LLSD foo = (*found_store_cert)->getLLSD();
+ // validate the store cert against the depth
+ _validateCert(validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS,
+ (*found_store_cert),
+ LLSD(),
+ depth);
+
+ // verify the signature of the CA
+ if(!_verify_signature((*found_store_cert),
+ (*current_cert)))
+ {
+ throw LLCertValidationInvalidSignatureException(*current_cert);
+ }
+ // successfully validated.
+ return;
+ }
+ previous_cert = (*current_cert);
+ current_cert++;
+ depth++;
+ }
+ if (validation_policy & VALIDATION_POLICY_TRUSTED)
+ {
+ LLPointer<LLCertificate> untrusted_ca_cert = (*this)[size()-1];
+ // we reached the end without finding a trusted cert.
+ throw LLCertValidationTrustException((*this)[size()-1]);
+
+ }
+}
+
+
+// LLSecAPIBasicHandler Class
+// Interface handler class for the various security storage handlers.
+
+// We read the file on construction, and write it on destruction. This
+// means multiple processes cannot modify the datastore.
+LLSecAPIBasicHandler::LLSecAPIBasicHandler(const std::string& protected_data_file,
+ const std::string& legacy_password_path)
+{
+ mProtectedDataFilename = protected_data_file;
+ mProtectedDataMap = LLSD::emptyMap();
+ mLegacyPasswordPath = legacy_password_path;
+
+}
+
+LLSecAPIBasicHandler::LLSecAPIBasicHandler()
+{
+}
+
+
+void LLSecAPIBasicHandler::init()
+{
+ mProtectedDataMap = LLSD::emptyMap();
+ if (mProtectedDataFilename.length() == 0)
+ {
+ mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "bin_conf.dat");
+ mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
+
+ mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "bin_conf.dat");
+ std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "CA.pem");
+ // copy the CA file to a user writable location so we can manipulate it.
+ // for this provider, by using a user writable file, there is a risk that
+ // an attacking program can modify the file, but OS dependent providers
+ // will reduce that risk.
+ // by using a user file, modifications will be limited to one user if
+ // we read-only the main file
+ if (!LLFile::isfile(store_file))
+ {
+
+ std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
+ llifstream ca_file(ca_file_path.c_str(), llifstream::binary | llifstream::in);
+ llofstream copied_store_file(store_file.c_str(), llofstream::binary | llofstream::out);
+
+ while(!ca_file.fail())
+ {
+ char buffer[BUFFER_READ_SIZE];
+ ca_file.read(buffer, sizeof(buffer));
+ copied_store_file.write(buffer, ca_file.gcount());
+ }
+ ca_file.close();
+ copied_store_file.close();
+ }
+ LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
+ mStore = new LLBasicCertificateStore(store_file);
+ }
+ _readProtectedData(); // initialize mProtectedDataMap
+ // may throw LLProtectedDataException if saved datamap is not decryptable
+}
+LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
+{
+ _writeProtectedData();
+}
+
+void LLSecAPIBasicHandler::_readProtectedData()
+{
+ // attempt to load the file into our map
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ llifstream protected_data_stream(mProtectedDataFilename.c_str(),
+ llifstream::binary);
+
+ if (!protected_data_stream.fail()) {
+ int offset;
+ U8 salt[STORE_SALT_SIZE];
+ U8 buffer[BUFFER_READ_SIZE];
+ U8 decrypted_buffer[BUFFER_READ_SIZE];
+ int decrypted_length;
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
+ LLXORCipher cipher(MACAddress, MAC_ADDRESS_BYTES);
+
+ // read in the salt and key
+ protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
+ offset = 0;
+ if (protected_data_stream.gcount() < STORE_SALT_SIZE)
+ {
+ throw LLProtectedDataException("Config file too short.");
+ }
+
+ cipher.decrypt(salt, STORE_SALT_SIZE);
+
+ // totally lame. As we're not using the OS level protected data, we need to
+ // at least obfuscate the data. We do this by using a salt stored at the head of the file
+ // to encrypt the data, therefore obfuscating it from someone using simple existing tools.
+ // We do include the MAC address as part of the obfuscation, which would require an
+ // attacker to get the MAC address as well as the protected store, which improves things
+ // somewhat. It would be better to use the password, but as this store
+ // will be used to store the SL password when the user decides to have SL remember it,
+ // so we can't use that. OS-dependent store implementations will use the OS password/storage
+ // mechanisms and are considered to be more secure.
+ // We've a strong intent to move to OS dependent protected data stores.
+
+
+ // read in the rest of the file.
+ EVP_CIPHER_CTX ctx;
+ EVP_CIPHER_CTX_init(&ctx);
+ EVP_DecryptInit(&ctx, EVP_rc4(), salt, NULL);
+ // allocate memory:
+ std::string decrypted_data;
+
+ while(protected_data_stream.good()) {
+ // read data as a block:
+ protected_data_stream.read((char *)buffer, BUFFER_READ_SIZE);
+
+ EVP_DecryptUpdate(&ctx, decrypted_buffer, &decrypted_length,
+ buffer, protected_data_stream.gcount());
+ decrypted_data.append((const char *)decrypted_buffer, protected_data_stream.gcount());
+ }
+
+ // RC4 is a stream cipher, so we don't bother to EVP_DecryptFinal, as there is
+ // no block padding.
+ EVP_CIPHER_CTX_cleanup(&ctx);
+ std::istringstream parse_stream(decrypted_data);
+ if (parser->parse(parse_stream, mProtectedDataMap,
+ LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
+ {
+ throw LLProtectedDataException("Config file cannot be decrypted.");
+ }
+ }
+}
+
+void LLSecAPIBasicHandler::_writeProtectedData()
+{
+ std::ostringstream formatted_data_ostream;
+ U8 salt[STORE_SALT_SIZE];
+ U8 buffer[BUFFER_READ_SIZE];
+ U8 encrypted_buffer[BUFFER_READ_SIZE];
+
+
+ if(mProtectedDataMap.isUndefined())
+ {
+ LLFile::remove(mProtectedDataFilename);
+ return;
+ }
+ // create a string with the formatted data.
+ LLSDSerialize::toXML(mProtectedDataMap, formatted_data_ostream);
+ std::istringstream formatted_data_istream(formatted_data_ostream.str());
+ // generate the seed
+ RAND_bytes(salt, STORE_SALT_SIZE);
+
+
+ // write to a temp file so we don't clobber the initial file if there is
+ // an error.
+ std::string tmp_filename = mProtectedDataFilename + ".tmp";
+
+ llofstream protected_data_stream(tmp_filename.c_str(),
+ llofstream::binary);
+ try
+ {
+
+ EVP_CIPHER_CTX ctx;
+ EVP_CIPHER_CTX_init(&ctx);
+ EVP_EncryptInit(&ctx, EVP_rc4(), salt, NULL);
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
+ LLXORCipher cipher(MACAddress, MAC_ADDRESS_BYTES);
+ cipher.encrypt(salt, STORE_SALT_SIZE);
+ protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);
+
+ while (formatted_data_istream.good())
+ {
+ formatted_data_istream.read((char *)buffer, BUFFER_READ_SIZE);
+ if(formatted_data_istream.gcount() == 0)
+ {
+ break;
+ }
+ int encrypted_length;
+ EVP_EncryptUpdate(&ctx, encrypted_buffer, &encrypted_length,
+ buffer, formatted_data_istream.gcount());
+ protected_data_stream.write((const char *)encrypted_buffer, encrypted_length);
+ }
+
+ // no EVP_EncrypteFinal, as this is a stream cipher
+ EVP_CIPHER_CTX_cleanup(&ctx);
+
+ protected_data_stream.close();
+ }
+ catch (...)
+ {
+ // it's good practice to clean up any secure information on error
+ // (even though this file isn't really secure. Perhaps in the future
+ // it may be, however.
+ LLFile::remove(tmp_filename);
+ throw LLProtectedDataException("Error writing Protected Data Store");
+ }
+
+ // move the temporary file to the specified file location.
+ if((((LLFile::isfile(mProtectedDataFilename) != 0) &&
+ (LLFile::remove(mProtectedDataFilename) != 0))) ||
+ (LLFile::rename(tmp_filename, mProtectedDataFilename)))
+ {
+ LLFile::remove(tmp_filename);
+ throw LLProtectedDataException("Could not overwrite protected data store");
+ }
+}
+
+// instantiate a certificate from a pem string
+LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert)
+{
+ LLPointer<LLCertificate> result = new LLBasicCertificate(pem_cert);
+ return result;
+}
+
+
+
+// instiate a certificate from an openssl X509 structure
+LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(X509* openssl_cert)
+{
+ LLPointer<LLCertificate> result = new LLBasicCertificate(openssl_cert);
+ return result;
+}
+
+// instantiate a chain from an X509_STORE_CTX
+LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(const X509_STORE_CTX* chain)
+{
+ LLPointer<LLCertificateChain> result = new LLBasicCertificateChain(chain);
+ return result;
+}
+
+// instantiate a cert store given it's id. if a persisted version
+// exists, it'll be loaded. If not, one will be created (but not
+// persisted)
+LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id)
+{
+ return mStore;
+}
+
+// retrieve protected data
+LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type,
+ const std::string& data_id)
+{
+
+ if (mProtectedDataMap.has(data_type) &&
+ mProtectedDataMap[data_type].isMap() &&
+ mProtectedDataMap[data_type].has(data_id))
+ {
+ return mProtectedDataMap[data_type][data_id];
+ }
+
+ return LLSD();
+}
+
+void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type,
+ const std::string& data_id)
+{
+ if (mProtectedDataMap.has(data_type) &&
+ mProtectedDataMap[data_type].isMap() &&
+ mProtectedDataMap[data_type].has(data_id))
+ {
+ mProtectedDataMap[data_type].erase(data_id);
+ }
+}
+
+
+//
+// persist data in a protected store
+//
+void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type,
+ const std::string& data_id,
+ const LLSD& data)
+{
+ if (!mProtectedDataMap.has(data_type) || !mProtectedDataMap[data_type].isMap()) {
+ mProtectedDataMap[data_type] = LLSD::emptyMap();
+ }
+
+ mProtectedDataMap[data_type][data_id] = data;
+}
+
+//
+// Create a credential object from an identifier and authenticator. credentials are
+// per grid.
+LLPointer<LLCredential> LLSecAPIBasicHandler::createCredential(const std::string& grid,
+ const LLSD& identifier,
+ const LLSD& authenticator)
+{
+ LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
+ result->setCredentialData(identifier, authenticator);
+ return result;
+}
+
+// Load a credential from the credential store, given the grid
+LLPointer<LLCredential> LLSecAPIBasicHandler::loadCredential(const std::string& grid)
+{
+ LLSD credential = getProtectedData("credential", grid);
+ LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
+ if(credential.isMap() &&
+ credential.has("identifier"))
+ {
+
+ LLSD identifier = credential["identifier"];
+ LLSD authenticator;
+ if (credential.has("authenticator"))
+ {
+ authenticator = credential["authenticator"];
+ }
+ result->setCredentialData(identifier, authenticator);
+ }
+ else
+ {
+ // credential was not in protected storage, so pull the credential
+ // from the legacy store.
+ std::string first_name = gSavedSettings.getString("FirstName");
+ std::string last_name = gSavedSettings.getString("LastName");
+
+ if ((first_name != "") &&
+ (last_name != ""))
+ {
+ LLSD identifier = LLSD::emptyMap();
+ LLSD authenticator;
+ identifier["type"] = "agent";
+ identifier["first_name"] = first_name;
+ identifier["last_name"] = last_name;
+
+ std::string legacy_password = _legacyLoadPassword();
+ if (legacy_password.length() > 0)
+ {
+ authenticator = LLSD::emptyMap();
+ authenticator["type"] = "hash";
+ authenticator["algorithm"] = "md5";
+ authenticator["secret"] = legacy_password;
+ }
+ result->setCredentialData(identifier, authenticator);
+ }
+ }
+ return result;
+}
+
+// Save the credential to the credential store. Save the authenticator also if requested.
+// That feature is used to implement the 'remember password' functionality.
+void LLSecAPIBasicHandler::saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)
+{
+ LLSD credential = LLSD::emptyMap();
+ credential["identifier"] = cred->getIdentifier();
+ if (save_authenticator)
+ {
+ credential["authenticator"] = cred->getAuthenticator();
+ }
+ LL_INFOS("SECAPI") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
+ setProtectedData("credential", cred->getGrid(), credential);
+ //*TODO: If we're saving Agni credentials, should we write the
+ // credentials to the legacy password.dat/etc?
+ _writeProtectedData();
+}
+
+// Remove a credential from the credential store.
+void LLSecAPIBasicHandler::deleteCredential(LLPointer<LLCredential> cred)
+{
+ LLSD undefVal;
+ deleteProtectedData("credential", cred->getGrid());
+ cred->setCredentialData(undefVal, undefVal);
+ _writeProtectedData();
+}
+
+// load the legacy hash for agni, and decrypt it given the
+// mac address
+std::string LLSecAPIBasicHandler::_legacyLoadPassword()
+{
+ const S32 HASHED_LENGTH = 32;
+ std::vector<U8> buffer(HASHED_LENGTH);
+ llifstream password_file(mLegacyPasswordPath, llifstream::binary);
+
+ if(password_file.fail())
+ {
+ return std::string("");
+ }
+
+ password_file.read((char*)&buffer[0], buffer.size());
+ if(password_file.gcount() != buffer.size())
+ {
+ return std::string("");
+ }
+
+ // Decipher with MAC address
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
+ LLXORCipher cipher(MACAddress, 6);
+ cipher.decrypt(&buffer[0], buffer.size());
+
+ return std::string((const char*)&buffer[0], buffer.size());
+}
+
+
+// return an identifier for the user
+std::string LLSecAPIBasicCredential::userID() const
+{
+ if (!mIdentifier.isMap())
+ {
+ return mGrid + "(null)";
+ }
+ else if ((std::string)mIdentifier["type"] == "agent")
+ {
+ return (std::string)mIdentifier["first_name"] + "_" + (std::string)mIdentifier["last_name"];
+ }
+ else if ((std::string)mIdentifier["type"] == "account")
+ {
+ return (std::string)mIdentifier["account_name"];
+ }
+
+ return "unknown";
+
+}
+
+// return a printable user identifier
+std::string LLSecAPIBasicCredential::asString() const
+{
+ if (!mIdentifier.isMap())
+ {
+ return mGrid + ":(null)";
+ }
+ else if ((std::string)mIdentifier["type"] == "agent")
+ {
+ return mGrid + ":" + (std::string)mIdentifier["first_name"] + " " + (std::string)mIdentifier["last_name"];
+ }
+ else if ((std::string)mIdentifier["type"] == "account")
+ {
+ return mGrid + ":" + (std::string)mIdentifier["account_name"];
+ }
+
+ return mGrid + ":(unknown type)";
+}
+
+
+bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs)
+{
+ if (lhs.type() != rhs.type())
+ {
+ return FALSE;
+ }
+ if (lhs.isMap())
+ {
+ // iterate through the map, verifying the right hand side has all of the
+ // values that the left hand side has.
+ for (LLSD::map_const_iterator litt = lhs.beginMap();
+ litt != lhs.endMap();
+ litt++)
+ {
+ if (!rhs.has(litt->first))
+ {
+ return FALSE;
+ }
+ }
+
+ // Now validate that the left hand side has everything the
+ // right hand side has, and that the values are equal.
+ for (LLSD::map_const_iterator ritt = rhs.beginMap();
+ ritt != rhs.endMap();
+ ritt++)
+ {
+ if (!lhs.has(ritt->first))
+ {
+ return FALSE;
+ }
+ if (!valueCompareLLSD(lhs[ritt->first], ritt->second))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+ }
+ else if (lhs.isArray())
+ {
+ LLSD::array_const_iterator ritt = rhs.beginArray();
+ // iterate through the array, comparing
+ for (LLSD::array_const_iterator litt = lhs.beginArray();
+ litt != lhs.endArray();
+ litt++)
+ {
+ if (!valueCompareLLSD(*ritt, *litt))
+ {
+ return FALSE;
+ }
+ ritt++;
+ }
+
+ return (ritt == rhs.endArray());
+ }
+ else
+ {
+ // simple type, compare as string
+ return (lhs.asString() == rhs.asString());
+ }
+
+}
diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h
new file mode 100644
index 0000000000..4bbb73f062
--- /dev/null
+++ b/indra/newview/llsechandler_basic.h
@@ -0,0 +1,285 @@
+/**
+ * @file llsechandler_basic.h
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LLSECHANDLER_BASIC
+#define LLSECHANDLER_BASIC
+
+#include "llsecapi.h"
+#include <vector>
+#include <openssl/x509.h>
+
+// helpers
+extern LLSD cert_name_from_X509_NAME(X509_NAME* name);
+extern std::string cert_string_name_from_X509_NAME(X509_NAME* name);
+extern std::string cert_string_from_asn1_integer(ASN1_INTEGER* value);
+extern LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time);
+extern std::string cert_get_digest(const std::string& digest_type, X509 *cert);
+
+
+// class LLCertificate
+//
+class LLBasicCertificate : public LLCertificate
+{
+public:
+ LOG_CLASS(LLBasicCertificate);
+
+ LLBasicCertificate(const std::string& pem_cert);
+ LLBasicCertificate(X509* openSSLX509);
+
+ virtual ~LLBasicCertificate();
+
+ virtual std::string getPem() const;
+ virtual std::vector<U8> getBinary() const;
+ virtual LLSD getLLSD() const;
+
+ virtual X509* getOpenSSLX509() const;
+
+ // set llsd elements for testing
+ void setLLSD(const std::string name, const LLSD& value) { mLLSDInfo[name] = value; }
+protected:
+
+ // certificates are stored as X509 objects, as validation and
+ // other functionality is via openssl
+ X509* mCert;
+
+ LLSD& _initLLSD();
+ LLSD mLLSDInfo;
+};
+
+
+// class LLBasicCertificateVector
+// Class representing a list of certificates
+// This implementation uses a stl vector of certificates.
+class LLBasicCertificateVector : virtual public LLCertificateVector
+{
+
+public:
+ LLBasicCertificateVector() {}
+
+ virtual ~LLBasicCertificateVector() {}
+
+ // Implementation of the basic iterator implementation.
+ // The implementation uses a vector iterator derived from
+ // the vector in the LLBasicCertificateVector class
+ class BasicIteratorImpl : public iterator_impl
+ {
+ public:
+ BasicIteratorImpl(std::vector<LLPointer<LLCertificate> >::iterator _iter) { mIter = _iter;}
+ virtual ~BasicIteratorImpl() {};
+ // seek forward or back. Used by the operator++/operator-- implementations
+ virtual void seek(bool incr)
+ {
+ if(incr)
+ {
+ mIter++;
+ }
+ else
+ {
+ mIter--;
+ }
+ }
+ // create a copy of the iterator implementation class, used by the iterator copy constructor
+ virtual LLPointer<iterator_impl> clone() const
+ {
+ return new BasicIteratorImpl(mIter);
+ }
+
+ virtual bool equals(const LLPointer<iterator_impl>& _iter) const
+ {
+ const BasicIteratorImpl *rhs_iter = dynamic_cast<const BasicIteratorImpl *>(_iter.get());
+ return (mIter == rhs_iter->mIter);
+ }
+ virtual LLPointer<LLCertificate> get()
+ {
+ return *mIter;
+ }
+ protected:
+ friend class LLBasicCertificateVector;
+ std::vector<LLPointer<LLCertificate> >::iterator mIter;
+ };
+
+ // numeric index of the vector
+ virtual LLPointer<LLCertificate> operator[](int _index) { return mCerts[_index];}
+
+ // Iteration
+ virtual iterator begin() { return iterator(new BasicIteratorImpl(mCerts.begin())); }
+
+ virtual iterator end() { return iterator(new BasicIteratorImpl(mCerts.end())); }
+
+ // find a cert given params
+ virtual iterator find(const LLSD& params);
+
+ // return the number of certs in the store
+ virtual int size() const { return mCerts.size(); }
+
+ // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void add(LLPointer<LLCertificate> cert) { insert(end(), cert); }
+
+ // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void insert(iterator _iter, LLPointer<LLCertificate> cert);
+
+ // remove a certificate from the store
+ virtual LLPointer<LLCertificate> erase(iterator _iter);
+
+protected:
+ std::vector<LLPointer<LLCertificate> >mCerts;
+};
+
+// class LLCertificateStore
+// represents a store of certificates, typically a store of root CA
+// certificates. The store can be persisted, and can be used to validate
+// a cert chain
+//
+class LLBasicCertificateStore : virtual public LLBasicCertificateVector, public LLCertificateStore
+{
+public:
+ LLBasicCertificateStore(const std::string& filename);
+ void load_from_file(const std::string& filename);
+
+ virtual ~LLBasicCertificateStore();
+
+ // persist the store
+ virtual void save();
+
+ // return the store id
+ virtual std::string storeId() const;
+
+protected:
+ std::vector<LLPointer<LLCertificate> >mCerts;
+ std::string mFilename;
+};
+
+// class LLCertificateChain
+// Class representing a chain of certificates in order, with the
+// first element being the child cert.
+class LLBasicCertificateChain : virtual public LLBasicCertificateVector, public LLCertificateChain
+{
+
+public:
+ LLBasicCertificateChain(const X509_STORE_CTX * store);
+
+ virtual ~LLBasicCertificateChain() {}
+
+ // validate a certificate chain against a certificate store, using the
+ // given validation policy.
+ virtual void validate(int validation_policy,
+ LLPointer<LLCertificateStore> ca_store,
+ const LLSD& validation_params);
+};
+
+
+
+// LLSecAPIBasicCredential class
+class LLSecAPIBasicCredential : public LLCredential
+{
+public:
+ LLSecAPIBasicCredential(const std::string& grid) : LLCredential(grid) {}
+ virtual ~LLSecAPIBasicCredential() {}
+ // return a value representing the user id, (could be guid, name, whatever)
+ virtual std::string userID() const;
+
+ // printible string identifying the credential.
+ virtual std::string asString() const;
+};
+
+// LLSecAPIBasicHandler Class
+// Interface handler class for the various security storage handlers.
+class LLSecAPIBasicHandler : public LLSecAPIHandler
+{
+public:
+
+ LLSecAPIBasicHandler(const std::string& protected_data_filename,
+ const std::string& legacy_password_path);
+ LLSecAPIBasicHandler();
+
+ void init();
+
+ virtual ~LLSecAPIBasicHandler();
+
+ // instantiate a certificate from a pem string
+ virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert);
+
+
+ // instiate a certificate from an openssl X509 structure
+ virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert);
+
+ // instantiate a chain from an X509_STORE_CTX
+ virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain);
+
+ // instantiate a cert store given it's id. if a persisted version
+ // exists, it'll be loaded. If not, one will be created (but not
+ // persisted)
+ virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id);
+
+ // persist data in a protected store
+ virtual void setProtectedData(const std::string& data_type,
+ const std::string& data_id,
+ const LLSD& data);
+
+ // retrieve protected data
+ virtual LLSD getProtectedData(const std::string& data_type,
+ const std::string& data_id);
+
+ // delete a protected data item from the store
+ virtual void deleteProtectedData(const std::string& data_type,
+ const std::string& data_id);
+
+ // credential management routines
+
+ virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+ const LLSD& identifier,
+ const LLSD& authenticator);
+
+ virtual LLPointer<LLCredential> loadCredential(const std::string& grid);
+
+ virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator);
+
+ virtual void deleteCredential(LLPointer<LLCredential> cred);
+
+protected:
+ void _readProtectedData();
+ void _writeProtectedData();
+ std::string _legacyLoadPassword();
+
+ std::string mProtectedDataFilename;
+ LLSD mProtectedDataMap;
+ LLPointer<LLBasicCertificateStore> mStore;
+
+ std::string mLegacyPasswordPath;
+};
+
+bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs);
+
+#endif // LLSECHANDLER_BASIC
+
+
+
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 2c26bada20..af16b962e6 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2435,7 +2435,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
if (identical)
{
- name = LLSLURL::buildCommand("agent", first_id, "inspect");
+ name = LLSLURL("agent", first_id, "inspect").getSLURLString();
}
else
{
@@ -2494,11 +2494,11 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
BOOL public_owner = (first_id.isNull() && !first_group_owned);
if (first_group_owned)
{
- name = LLSLURL::buildCommand("group", first_id, "inspect");
+ name = LLSLURL("group", first_id, "inspect").getSLURLString();
}
else if(!public_owner)
{
- name = LLSLURL::buildCommand("agent", first_id, "inspect");
+ name = LLSLURL("agent", first_id, "inspect").getSLURLString();
}
else
{
@@ -2558,7 +2558,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
BOOL public_owner = (first_id.isNull());
if(!public_owner)
{
- name = LLSLURL::buildCommand("agent", first_id, "inspect");
+ name = LLSLURL("agent", first_id, "inspect").getSLURLString();
}
else
{
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 08098e2adb..0086c6aec4 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -317,7 +317,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
{
if (!wearable)
{
- wearable = gAgentWearables.getWearable(WT_SHAPE, 0);
+ wearable = gAgentWearables.getWearable(LLWearableType::WT_SHAPE, 0);
}
if (!mEditWearable || !wearable)
{
@@ -389,11 +389,11 @@ void LLSidepanelAppearance::fetchInventory()
mNewOutfitBtn->setEnabled(false);
uuid_vec_t ids;
LLUUID item_id;
- for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
+ for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type)
{
- for (U32 index = 0; index < gAgentWearables.getWearableCount((EWearableType)type); ++index)
+ for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index)
{
- item_id = gAgentWearables.getWearableItemID((EWearableType)type, index);
+ item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index);
if(item_id.notNull())
{
ids.push_back(item_id);
@@ -439,3 +439,9 @@ void LLSidepanelAppearance::inventoryFetched()
{
mNewOutfitBtn->setEnabled(true);
}
+
+void LLSidepanelAppearance::setWearablesLoading(bool val)
+{
+ childSetVisible("wearables_loading_indicator", val);
+ childSetVisible("edit_outfit_btn", !val);
+}
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index 0a2d882a0b..2900831099 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -65,6 +65,7 @@ public:
void showOutfitsInventoryPanel();
void showOutfitEditPanel();
+ void setWearablesLoading(bool val);
private:
void onFilterEdit(const std::string& search_string);
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index fa543f1371..65b9184fe5 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -323,8 +323,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
U32 LLSidepanelInventory::getSelectedCount()
{
LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- std::set<LLUUID> selection_list;
- panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(selection_list);
+ std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
return selection_list.size();
}
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index 5d20e280b5..ff7e479368 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -1,10 +1,11 @@
/**
- * @file llslurl.cpp
- * @brief SLURL manipulation
+ * @file llurlsimstring.cpp (was llsimurlstring.cpp)
+ * @brief Handles "SLURL fragments" like Ahern/123/45 for
+ * startup processing, login screen, prefs, etc.
*
- * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
*
- * Copyright (c) 2009, Linden Research, Inc.
+ * Copyright (c) 2006-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +13,12 @@
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -34,155 +34,443 @@
#include "llslurl.h"
-#include "llweb.h"
-
-#include "llurlregistry.h"
-
-const std::string LLSLURL::PREFIX_SL_HELP = "secondlife://app.";
-const std::string LLSLURL::PREFIX_SL = "sl://";
-const std::string LLSLURL::PREFIX_SECONDLIFE = "secondlife://";
-const std::string LLSLURL::PREFIX_SLURL_OLD = "http://slurl.com/secondlife/";
-
-// For DnD - even though www.slurl.com redirects to slurl.com in a browser, you can copy and drag
+#include "llpanellogin.h"
+#include "llviewercontrol.h"
+#include "llviewernetwork.h"
+#include "llfiltersd2xmlrpc.h"
+#include "curl/curl.h"
+const char* LLSLURL::SLURL_HTTP_SCHEME = "http";
+const char* LLSLURL::SLURL_HTTPS_SCHEME = "https";
+const char* LLSLURL::SLURL_SECONDLIFE_SCHEME = "secondlife";
+const char* LLSLURL::SLURL_SECONDLIFE_PATH = "secondlife";
+const char* LLSLURL::SLURL_COM = "slurl.com";
+// For DnD - even though www.slurl.com redirects to slurl.com in a browser, you can copy and drag
// text with www.slurl.com or a link explicitly pointing at www.slurl.com so testing for this
// version is required also.
-const std::string LLSLURL::PREFIX_SLURL_WWW = "http://www.slurl.com/secondlife/";
-const std::string LLSLURL::PREFIX_SLURL = "http://maps.secondlife.com/secondlife/";
+const char* LLSLURL::WWW_SLURL_COM = "www.slurl.com";
+const char* LLSLURL::MAPS_SECONDLIFE_COM = "maps.secondlife.com";
+const char* LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME = "x-grid-location-info";
+const char* LLSLURL::SLURL_APP_PATH = "app";
+const char* LLSLURL::SLURL_REGION_PATH = "region";
+const char* LLSLURL::SIM_LOCATION_HOME = "home";
+const char* LLSLURL::SIM_LOCATION_LAST = "last";
-const std::string LLSLURL::APP_TOKEN = "app/";
-
-// static
-std::string LLSLURL::stripProtocol(const std::string& url)
+// resolve a simstring from a slurl
+LLSLURL::LLSLURL(const std::string& slurl)
{
- std::string stripped = url;
- if (matchPrefix(stripped, PREFIX_SL_HELP))
- {
- stripped.erase(0, PREFIX_SL_HELP.length());
- }
- else if (matchPrefix(stripped, PREFIX_SL))
- {
- stripped.erase(0, PREFIX_SL.length());
- }
- else if (matchPrefix(stripped, PREFIX_SECONDLIFE))
- {
- stripped.erase(0, PREFIX_SECONDLIFE.length());
- }
- else if (matchPrefix(stripped, PREFIX_SLURL))
+ // by default we go to agni.
+ mType = INVALID;
+ LL_INFOS("AppInit") << "SLURL: " << slurl << LL_ENDL;
+ if(slurl == SIM_LOCATION_HOME)
{
- stripped.erase(0, PREFIX_SLURL.length());
+ mType = HOME_LOCATION;
}
- else if (matchPrefix(stripped, PREFIX_SLURL_OLD))
+ else if(slurl.empty() || (slurl == SIM_LOCATION_LAST))
{
- stripped.erase(0, PREFIX_SLURL_OLD.length());
+
+ mType = LAST_LOCATION;
}
- else if (matchPrefix(stripped, PREFIX_SLURL_WWW))
+ else
{
- stripped.erase(0, PREFIX_SLURL_WWW.length());
+ LLURI slurl_uri;
+ // parse the slurl as a uri
+ if(slurl.find(':') == std::string::npos)
+ {
+ // There may be no scheme ('secondlife:' etc.) passed in. In that case
+ // we want to normalize the slurl by putting the appropriate scheme
+ // in front of the slurl. So, we grab the appropriate slurl base
+ // from the grid manager which may be http://slurl.com/secondlife/ for maingrid, or
+ // https://<hostname>/region/ for Standalone grid (the word region, not the region name)
+ // these slurls are typically passed in from the 'starting location' box on the login panel,
+ // where the user can type in <regionname>/<x>/<y>/<z>
+ std::string fixed_slurl = LLGridManager::getInstance()->getSLURLBase();
+ // the slurl that was passed in might have a prepended /, or not. So,
+ // we strip off the prepended '/' so we don't end up with http://slurl.com/secondlife/<region>/<x>/<y>/<z>
+ // or some such.
+
+ if(slurl[0] == '/')
+ {
+ fixed_slurl += slurl.substr(1);
+ }
+ else
+ {
+ fixed_slurl += slurl;
+ }
+ // We then load the slurl into a LLURI form
+ slurl_uri = LLURI(fixed_slurl);
+ }
+ else
+ {
+ // as we did have a scheme, implying a URI style slurl, we
+ // simply parse it as a URI
+ slurl_uri = LLURI(slurl);
+ }
+
+ LLSD path_array = slurl_uri.pathArray();
+
+ // determine whether it's a maingrid URI or an Standalone/open style URI
+ // by looking at the scheme. If it's a 'secondlife:' slurl scheme or
+ // 'sl:' scheme, we know it's maingrid
+
+ // At the end of this if/else block, we'll have determined the grid,
+ // and the slurl type (APP or LOCATION)
+ if(slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
+ {
+ // parse a maingrid style slurl. We know the grid is maingrid
+ // so grab it.
+ // A location slurl for maingrid (with the special schemes) can be in the form
+ // secondlife://<regionname>/<x>/<y>/<z>
+ // or
+ // secondlife://<Grid>/secondlife/<region>/<x>/<y>/<z>
+ // where if grid is empty, it specifies Agni
+
+ // An app style slurl for maingrid can be
+ // secondlife://<Grid>/app/<app parameters>
+ // where an empty grid implies Agni
+
+ // we'll start by checking the top of the 'path' which will be
+ // either 'app', 'secondlife', or <x>.
+
+ // default to maingrid
+
+ mGrid = MAINGRID;
+
+ if ((path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH) ||
+ (path_array[0].asString() == LLSLURL::SLURL_APP_PATH))
+ {
+ // it's in the form secondlife://<grid>/(app|secondlife)
+ // so parse the grid name to derive the grid ID
+ if (!slurl_uri.hostName().empty())
+ {
+ mGrid = LLGridManager::getInstance()->getGridByLabel(slurl_uri.hostName());
+ }
+ else if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
+ {
+ // If the slurl is in the form secondlife:///secondlife/<region> form,
+ // then we are in fact on maingrid.
+ mGrid = MAINGRID;
+ }
+ else if(path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
+ {
+ // for app style slurls, where no grid name is specified, assume the currently
+ // selected or logged in grid.
+ mGrid = LLGridManager::getInstance()->getGrid();
+ }
+
+ if(mGrid.empty())
+ {
+ // we couldn't find the grid in the grid manager, so bail
+ return;
+ }
+ // set the type as appropriate.
+ if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
+ {
+ mType = LOCATION;
+ }
+ else
+ {
+ mType = APP;
+ }
+ path_array.erase(0);
+ }
+ else
+ {
+ // it wasn't a /secondlife/<region> or /app/<params>, so it must be secondlife://<region>
+ // therefore the hostname will be the region name, and it's a location type
+ mType = LOCATION;
+ // 'normalize' it so the region name is in fact the head of the path_array
+ path_array.insert(0, slurl_uri.hostName());
+ }
+ }
+ else if((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME) ||
+ (slurl_uri.scheme() == LLSLURL::SLURL_HTTPS_SCHEME) ||
+ (slurl_uri.scheme() == LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME))
+ {
+ // We're dealing with either a Standalone style slurl or slurl.com slurl
+ if ((slurl_uri.hostName() == LLSLURL::SLURL_COM) ||
+ (slurl_uri.hostName() == LLSLURL::WWW_SLURL_COM) ||
+ (slurl_uri.hostName() == LLSLURL::MAPS_SECONDLIFE_COM))
+ {
+ // slurl.com implies maingrid
+ mGrid = MAINGRID;
+ }
+ else
+ {
+ // As it's a Standalone grid/open, we will always have a hostname, as Standalone/open style
+ // urls are properly formed, unlike the stinky maingrid style
+ mGrid = slurl_uri.hostName();
+ }
+ if (path_array.size() == 0)
+ {
+ // um, we need a path...
+ return;
+ }
+
+ // we need to normalize the urls so
+ // the path portion starts with the 'command' that we want to do
+ // it can either be region or app.
+ if ((path_array[0].asString() == LLSLURL::SLURL_REGION_PATH) ||
+ (path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH))
+ {
+ // strip off 'region' or 'secondlife'
+ path_array.erase(0);
+ // it's a location
+ mType = LOCATION;
+ }
+ else if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
+ {
+ mType = APP;
+ path_array.erase(0);
+ // leave app appended.
+ }
+ else
+ {
+ // not a valid https/http/x-grid-location-info slurl, so it'll likely just be a URL
+ return;
+ }
+ }
+ else
+ {
+ // invalid scheme, so bail
+ return;
+ }
+
+
+ if(path_array.size() == 0)
+ {
+ // we gotta have some stuff after the specifier as to whether it's a region or command
+ return;
+ }
+
+ // now that we know whether it's an app slurl or a location slurl,
+ // parse the slurl into the proper data structures.
+ if(mType == APP)
+ {
+ // grab the app command type and strip it (could be a command to jump somewhere,
+ // or whatever )
+ mAppCmd = path_array[0].asString();
+ path_array.erase(0);
+
+ // Grab the parameters
+ mAppPath = path_array;
+ // and the query
+ mAppQuery = slurl_uri.query();
+ mAppQueryMap = slurl_uri.queryMap();
+ return;
+ }
+ else if(mType == LOCATION)
+ {
+ // at this point, head of the path array should be [ <region>, <x>, <y>, <z> ] where x, y and z
+ // are collectively optional
+ // are optional
+ mRegion = LLURI::unescape(path_array[0].asString());
+ path_array.erase(0);
+
+ // parse the x, y, z
+ if(path_array.size() >= 3)
+ {
+
+ mPosition = LLVector3(path_array);
+ if((F32(mPosition[VX]) < 0.f) ||
+ (mPosition[VX] > REGION_WIDTH_METERS) ||
+ (F32(mPosition[VY]) < 0.f) ||
+ (mPosition[VY] > REGION_WIDTH_METERS) ||
+ (F32(mPosition[VZ]) < 0.f) ||
+ (mPosition[VZ] > REGION_HEIGHT_METERS))
+ {
+ mType = INVALID;
+ return;
+ }
+
+ }
+ else
+ {
+ // if x, y and z were not fully passed in, go to the middle of the region.
+ // teleport will adjust the actual location to make sure you're on the ground
+ // and such
+ mPosition = LLVector3(REGION_WIDTH_METERS/2, REGION_WIDTH_METERS/2, 0);
+ }
+ }
}
-
- return stripped;
}
-// static
-bool LLSLURL::isSLURL(const std::string& url)
+
+// Create a slurl for the middle of the region
+LLSLURL::LLSLURL(const std::string& grid,
+ const std::string& region)
{
- if (matchPrefix(url, PREFIX_SL_HELP)) return true;
- if (matchPrefix(url, PREFIX_SL)) return true;
- if (matchPrefix(url, PREFIX_SECONDLIFE)) return true;
- if (matchPrefix(url, PREFIX_SLURL)) return true;
- if (matchPrefix(url, PREFIX_SLURL_OLD)) return true;
- if (matchPrefix(url, PREFIX_SLURL_WWW)) return true;
-
- return false;
+ mGrid = grid;
+ mRegion = region;
+ mType = LOCATION;
+ mPosition = LLVector3((F64)REGION_WIDTH_METERS/2, (F64)REGION_WIDTH_METERS/2, 0);
}
-bool LLSLURL::isValidSLURL(const std::string& url)
+
+
+// create a slurl given the position. The position will be modded with the region
+// width handling global positions as well
+LLSLURL::LLSLURL(const std::string& grid,
+ const std::string& region,
+ const LLVector3& position)
{
- std::string temp_url(url);
- //"www." may appear in DnD- see description of PREFIX_SLURL_WWW.
- // If it is found, we remove it because it isn't expected in regexp.
- if (matchPrefix(url, PREFIX_SLURL_WWW))
- {
- size_t position = url.find("www.");
- temp_url.erase(position,4);
- }
-
- return LLUrlRegistry::getInstance()->isUrl(temp_url);
+ mGrid = grid;
+ mRegion = region;
+ S32 x = llround( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
+ S32 y = llround( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
+ S32 z = llround( (F32)position[VZ] );
+ mType = LOCATION;
+ mPosition = LLVector3(x, y, z);
}
-// static
-bool LLSLURL::isSLURLCommand(const std::string& url)
-{
- if (matchPrefix(url, PREFIX_SL + APP_TOKEN) ||
- matchPrefix(url, PREFIX_SECONDLIFE + "/" + APP_TOKEN) ||
- matchPrefix(url, PREFIX_SLURL + APP_TOKEN) ||
- matchPrefix(url, PREFIX_SLURL_WWW + APP_TOKEN) ||
- matchPrefix(url, PREFIX_SLURL_OLD + APP_TOKEN) )
- {
- return true;
- }
- return false;
+// create a simstring
+LLSLURL::LLSLURL(const std::string& region,
+ const LLVector3& position)
+{
+ *this = LLSLURL(LLGridManager::getInstance()->getGrid(),
+ region, position);
}
-// static
-bool LLSLURL::isSLURLHelp(const std::string& url)
+// create a slurl from a global position
+LLSLURL::LLSLURL(const std::string& grid,
+ const std::string& region,
+ const LLVector3d& global_position)
{
- return matchPrefix(url, PREFIX_SL_HELP);
+ *this = LLSLURL(grid,
+ region, LLVector3(global_position.mdV[VX],
+ global_position.mdV[VY],
+ global_position.mdV[VZ]));
}
-// static
-std::string LLSLURL::buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
+// create a slurl from a global position
+LLSLURL::LLSLURL(const std::string& region,
+ const LLVector3d& global_position)
{
- std::string slurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z);
- slurl = LLWeb::escapeURL( slurl );
- return slurl;
+ *this = LLSLURL(LLGridManager::getInstance()->getGrid(),
+ region, global_position);
}
-// static
-std::string LLSLURL::buildCommand(const char* noun, const LLUUID& id, const char* verb)
+LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb)
{
- std::string slurl = llformat("secondlife:///app/%s/%s/%s",
- noun, id.asString().c_str(), verb);
- return slurl;
+ mType = APP;
+ mAppCmd = command;
+ mAppPath = LLSD::emptyArray();
+ mAppPath.append(LLSD(id));
+ mAppPath.append(LLSD(verb));
}
-// static
-std::string LLSLURL::buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
+
+std::string LLSLURL::getSLURLString() const
{
- std::string unescapedslurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z);
- return unescapedslurl;
+ switch(mType)
+ {
+ case HOME_LOCATION:
+ return SIM_LOCATION_HOME;
+ case LAST_LOCATION:
+ return SIM_LOCATION_LAST;
+ case LOCATION:
+ {
+ // lookup the grid
+ S32 x = llround( (F32)mPosition[VX] );
+ S32 y = llround( (F32)mPosition[VY] );
+ S32 z = llround( (F32)mPosition[VZ] );
+ return LLGridManager::getInstance()->getSLURLBase(mGrid) +
+ LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z);
+ }
+ case APP:
+ {
+ std::ostringstream app_url;
+ app_url << LLGridManager::getInstance()->getAppSLURLBase() << "/" << mAppCmd;
+ for(LLSD::array_const_iterator i = mAppPath.beginArray();
+ i != mAppPath.endArray();
+ i++)
+ {
+ app_url << "/" << i->asString();
+ }
+ if(mAppQuery.length() > 0)
+ {
+ app_url << "?" << mAppQuery;
+ }
+ return app_url.str();
+ }
+ default:
+ LL_WARNS("AppInit") << "Unexpected SLURL type for SLURL string" << (int)mType << LL_ENDL;
+ return std::string();
+ }
}
-// static
-std::string LLSLURL::buildSLURLfromPosGlobal(const std::string& regionname,
- const LLVector3d& global_pos,
- bool escaped /*= true*/)
+std::string LLSLURL::getLoginString() const
{
- S32 x, y, z;
- globalPosToXYZ(global_pos, x, y, z);
- if(escaped)
+
+ std::stringstream unescaped_start;
+ switch(mType)
{
- return buildSLURL(regionname, x, y, z);
+ case LOCATION:
+ unescaped_start << "uri:"
+ << mRegion << "&"
+ << llround(mPosition[0]) << "&"
+ << llround(mPosition[1]) << "&"
+ << llround(mPosition[2]);
+ break;
+ case HOME_LOCATION:
+ unescaped_start << "home";
+ break;
+ case LAST_LOCATION:
+ unescaped_start << "last";
+ break;
+ default:
+ LL_WARNS("AppInit") << "Unexpected SLURL type for login string" << (int)mType << LL_ENDL;
+ break;
}
- else
+ return xml_escape_string(unescaped_start.str());
+}
+
+bool LLSLURL::operator==(const LLSLURL& rhs)
+{
+ if(rhs.mType != mType) return false;
+ switch(mType)
{
- return buildUnescapedSLURL(regionname, x, y, z);
+ case LOCATION:
+ return ((mGrid == rhs.mGrid) &&
+ (mRegion == rhs.mRegion) &&
+ (mPosition == rhs.mPosition));
+ case APP:
+ return getSLURLString() == rhs.getSLURLString();
+
+ case HOME_LOCATION:
+ case LAST_LOCATION:
+ return true;
+ default:
+ return false;
}
}
-// static
-bool LLSLURL::matchPrefix(const std::string& url, const std::string& prefix)
+bool LLSLURL::operator !=(const LLSLURL& rhs)
{
- std::string test_prefix = url.substr(0, prefix.length());
- LLStringUtil::toLower(test_prefix);
- return test_prefix == prefix;
+ return !(*this == rhs);
}
-void LLSLURL::globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z)
+std::string LLSLURL::getLocationString() const
+{
+ return llformat("%s/%d/%d/%d",
+ mRegion.c_str(),
+ (int)llround(mPosition[0]),
+ (int)llround(mPosition[1]),
+ (int)llround(mPosition[2]));
+}
+std::string LLSLURL::asString() const
{
- x = llround((F32)fmod(pos.mdV[VX], (F64)REGION_WIDTH_METERS));
- y = llround((F32)fmod(pos.mdV[VY], (F64)REGION_WIDTH_METERS));
- z = llround((F32)pos.mdV[VZ]);
+ std::ostringstream result;
+ result << " mAppCmd:" << getAppCmd() <<
+ " mAppPath:" + getAppPath().asString() <<
+ " mAppQueryMap:" + getAppQueryMap().asString() <<
+ " mAppQuery: " + getAppQuery() <<
+ " mGrid: " + getGrid() <<
+ " mRegion: " + getRegion() <<
+ " mPosition: " <<
+ " mType: " << mType <<
+ " mPosition: " << mPosition;
+ return result.str();
}
+
diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h
index a79a8fc97c..28c23561cf 100644
--- a/indra/newview/llslurl.h
+++ b/indra/newview/llslurl.h
@@ -1,10 +1,11 @@
-/**
+/**
* @file llslurl.h
- * @brief SLURL manipulation
+ * @brief Handles "SLURL fragments" like Ahern/123/45 for
+ * startup processing, login screen, prefs, etc.
*
- * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
*
- * Copyright (c) 2009, Linden Research, Inc.
+ * Copyright (c) 2006-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +13,12 @@
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -29,85 +29,84 @@
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
+#ifndef LLSLURL_H
+#define LLSLURL_H
-#ifndef LL_SLURL_H
-#define LL_SLURL_H
+#include "llstring.h"
-#include <string>
-// IAN BUG: where should this live?
-// IAN BUG: are static utility functions right? See LLUUID.
-// question of whether to have a LLSLURL object or a
-// some of this was moved from LLURLDispatcher
+// represents a location in a grid
-/**
- * SLURL manipulation
- */
class LLSLURL
{
public:
- static const std::string PREFIX_SL_HELP;
- static const std::string PREFIX_SL;
- static const std::string PREFIX_SECONDLIFE;
- static const std::string PREFIX_SLURL;
- static const std::string PREFIX_SLURL_OLD;
- static const std::string PREFIX_SLURL_WWW;
-
- static const std::string APP_TOKEN;
-
- /**
- * Is this any sort of secondlife:// or sl:// URL?
- */
- static bool isSLURL(const std::string& url);
-
- /**
- * Returns true if url is proven valid by regexp check from LLUrlRegistry
- */
- static bool isValidSLURL(const std::string& url);
-
- /**
- * Is this a special secondlife://app/ URL?
- */
- static bool isSLURLCommand(const std::string& url);
-
- /**
- * Not sure what it is.
- */
- static bool isSLURLHelp(const std::string& url);
-
- /**
- * builds: http://slurl.com/secondlife/Region%20Name/x/y/z/ escaping result url.
- */
- static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
-
- /// Build a SLURL like secondlife:///app/agent/<uuid>/inspect
- static std::string buildCommand(const char* noun, const LLUUID& id, const char* verb);
-
- /**
- * builds: http://slurl.com/secondlife/Region Name/x/y/z/ without escaping result url.
- */
- static std::string buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
-
- /**
- * builds SLURL from global position. Returns escaped or unescaped url.
- * Returns escaped url by default.
- */
- static std::string buildSLURLfromPosGlobal(const std::string& regionname,
- const LLVector3d& global_pos,
- bool escaped = true);
- /**
- * Strip protocol part from the URL.
- */
- static std::string stripProtocol(const std::string& url);
-
- /**
- * Convert global position to X, Y Z
- */
- static void globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z);
-
-private:
- static bool matchPrefix(const std::string& url, const std::string& prefix);
-
+ static const char* SLURL_HTTPS_SCHEME;
+ static const char* SLURL_HTTP_SCHEME;
+ static const char* SLURL_SL_SCHEME;
+ static const char* SLURL_SECONDLIFE_SCHEME;
+ static const char* SLURL_SECONDLIFE_PATH;
+ static const char* SLURL_COM;
+ static const char* WWW_SLURL_COM;
+ static const char* MAPS_SECONDLIFE_COM;
+ static const char* SLURL_X_GRID_LOCATION_INFO_SCHEME;
+ static LLSLURL START_LOCATION;
+ static const char* SIM_LOCATION_HOME;
+ static const char* SIM_LOCATION_LAST;
+ static const char* SLURL_APP_PATH;
+ static const char* SLURL_REGION_PATH;
+
+ enum SLURL_TYPE {
+ INVALID,
+ LOCATION,
+ HOME_LOCATION,
+ LAST_LOCATION,
+ APP,
+ HELP
+ };
+
+
+ LLSLURL(): mType(LAST_LOCATION) { }
+ LLSLURL(const std::string& slurl);
+ LLSLURL(const std::string& grid, const std::string& region);
+ LLSLURL(const std::string& region, const LLVector3& position);
+ LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
+ LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
+ LLSLURL(const std::string& region, const LLVector3d& global_position);
+ LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
+
+ SLURL_TYPE getType() const { return mType; }
+
+ std::string getSLURLString() const;
+ std::string getLoginString() const;
+ std::string getLocationString() const;
+ std::string getGrid() const { return mGrid; }
+ std::string getRegion() const { return mRegion; }
+ LLVector3 getPosition() const { return mPosition; }
+ std::string getAppCmd() const { return mAppCmd; }
+ std::string getAppQuery() const { return mAppQuery; }
+ LLSD getAppQueryMap() const { return mAppQueryMap; }
+ LLSD getAppPath() const { return mAppPath; }
+
+ bool isValid() const { return mType != INVALID; }
+ bool isSpatial() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
+
+ bool operator==(const LLSLURL& rhs);
+ bool operator!=(const LLSLURL&rhs);
+
+ std::string asString() const ;
+
+protected:
+ SLURL_TYPE mType;
+
+ // used for Apps and Help
+ std::string mAppCmd;
+ LLSD mAppPath;
+ LLSD mAppQueryMap;
+ std::string mAppQuery;
+
+ std::string mGrid; // reference to grid manager grid
+ std::string mRegion;
+ LLVector3 mPosition;
};
-#endif
+#endif // LLSLURL_H
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
index c5c311ed33..d7de050636 100644
--- a/indra/newview/llspeakbutton.cpp
+++ b/indra/newview/llspeakbutton.cpp
@@ -59,9 +59,9 @@ LLSpeakButton::Params::Params()
void LLSpeakButton::draw()
{
- // gVoiceClient is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
- bool openmic = gVoiceClient->getUserPTTState();
- bool voiceenabled = gVoiceClient->voiceEnabled();
+ // LLVoiceClient::getInstance() is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
+ bool openmic = LLVoiceClient::getInstance()->getUserPTTState();
+ bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled();
mSpeakBtn->setToggleState(openmic && voiceenabled);
mOutputMonitor->setIsMuted(!voiceenabled);
LLUICtrl::draw();
@@ -176,11 +176,11 @@ void LLSpeakButton::setLabelVisible(bool visible)
void LLSpeakButton::onMouseDown_SpeakBtn()
{
bool down = true;
- gVoiceClient->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
+ LLVoiceClient::getInstance()->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
}
void LLSpeakButton::onMouseUp_SpeakBtn()
{
bool down = false;
- gVoiceClient->inputUserControlState(down);
+ LLVoiceClient::getInstance()->inputUserControlState(down);
}
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index ba6a44dff4..c8bb4aa983 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -299,7 +299,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
void LLSpeakerMgr::update(BOOL resort_ok)
{
- if (!gVoiceClient)
+ if (!LLVoiceClient::getInstance())
{
return;
}
@@ -313,7 +313,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
}
// update status of all current speakers
- BOOL voice_channel_active = (!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
+ BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end();)
{
LLUUID speaker_id = speaker_it->first;
@@ -321,21 +321,21 @@ void LLSpeakerMgr::update(BOOL resort_ok)
speaker_map_t::iterator cur_speaker_it = speaker_it++;
- if (voice_channel_active && gVoiceClient->getVoiceEnabled(speaker_id))
+ if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id))
{
- speakerp->mSpeechVolume = gVoiceClient->getCurrentPower(speaker_id);
- BOOL moderator_muted_voice = gVoiceClient->getIsModeratorMuted(speaker_id);
+ speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id);
+ BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id);
if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
{
speakerp->mModeratorMutedVoice = moderator_muted_voice;
speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
}
- if (gVoiceClient->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
+ if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
{
speakerp->mStatus = LLSpeaker::STATUS_MUTED;
}
- else if (gVoiceClient->getIsSpeaking(speaker_id))
+ else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id))
{
// reset inactivity expiration
if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING)
@@ -417,19 +417,21 @@ void LLSpeakerMgr::update(BOOL resort_ok)
void LLSpeakerMgr::updateSpeakerList()
{
// are we bound to the currently active voice channel?
- if ((!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
- {
- LLVoiceClient::participantMap* participants = gVoiceClient->getParticipantList();
- if(participants)
+ if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
+ {
+ std::set<LLUUID> participants;
+ LLVoiceClient::getInstance()->getParticipantList(participants);
+ // add new participants to our list of known speakers
+ for (std::set<LLUUID>::iterator participant_it = participants.begin();
+ participant_it != participants.end();
+ ++participant_it)
{
- LLVoiceClient::participantMap::iterator participant_it;
+ setSpeaker(*participant_it,
+ LLVoiceClient::getInstance()->getDisplayName(*participant_it),
+ LLSpeaker::STATUS_VOICE_ACTIVE,
+ (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
+
- // add new participants to our list of known speakers
- for (participant_it = participants->begin(); participant_it != participants->end(); ++participant_it)
- {
- LLVoiceClient::participantState* participantp = participant_it->second;
- setSpeaker(participantp->mAvatarID, participantp->mDisplayName, LLSpeaker::STATUS_VOICE_ACTIVE, (participantp->isAvatar()?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
- }
}
}
}
@@ -519,7 +521,7 @@ void LLSpeakerMgr::speakerChatted(const LLUUID& speaker_id)
BOOL LLSpeakerMgr::isVoiceActive()
{
// mVoiceChannel = NULL means current voice channel, whatever it is
- return LLVoiceClient::voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
+ return LLVoiceClient::getInstance()->voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
}
diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp
index cc06179481..29237946d2 100644
--- a/indra/newview/llspeakingindicatormanager.cpp
+++ b/indra/newview/llspeakingindicatormanager.cpp
@@ -158,7 +158,7 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i
mSpeakingIndicators.insert(value_type);
speaker_ids_t speakers_uuids;
- BOOL is_in_same_voice = LLVoiceClient::getInstance()->findParticipantByID(speaker_id) != NULL;
+ BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id);
speakers_uuids.insert(speaker_id);
switchSpeakerIndicators(speakers_uuids, is_in_same_voice);
@@ -210,7 +210,7 @@ void SpeakingIndicatorManager::onChange()
LL_DEBUGS("SpeakingIndicator") << "Voice participant list was changed, updating indicators" << LL_ENDL;
speaker_ids_t speakers_uuids;
- LLVoiceClient::getInstance()->getParticipantsUUIDSet(speakers_uuids);
+ LLVoiceClient::getInstance()->getParticipantList(speakers_uuids);
LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL;
// switch all indicators off
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 7ad7799515..a84bb98a90 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -147,7 +147,7 @@
#include "lltrans.h"
#include "llui.h"
#include "llurldispatcher.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
#include "llurlhistory.h"
#include "llurlwhitelist.h"
#include "llvieweraudio.h"
@@ -192,6 +192,7 @@
#include "llinventorybridge.h"
#include "llappearancemgr.h"
#include "llavatariconctrl.h"
+#include "llvoicechannel.h"
#include "lllogin.h"
#include "llevents.h"
@@ -228,11 +229,11 @@ static std::string sInitialOutfitGender; // "male" or "female"
static bool gUseCircuitCallbackCalled = false;
EStartupState LLStartUp::gStartupState = STATE_FIRST;
+LLSLURL LLStartUp::sStartSLURL;
-// *NOTE:Mani - to reconcile with giab changes...
-static std::string gFirstname;
-static std::string gLastname;
-static std::string gPassword;
+static LLPointer<LLCredential> gUserCredential;
+static std::string gDisplayName;
+static BOOL gRememberPassword = TRUE;
static U64 gFirstSimHandle = 0;
static LLHost gFirstSim;
@@ -249,7 +250,6 @@ boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener(
void login_show();
void login_callback(S32 option, void* userdata);
-bool is_hex_string(U8* str, S32 len);
void show_first_run_dialog();
bool first_run_dialog_callback(const LLSD& notification, const LLSD& response);
void set_startup_status(const F32 frac, const std::string& string, const std::string& msg);
@@ -262,6 +262,9 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response);
void init_start_screen(S32 location_id);
void release_start_screen();
void reset_login();
+LLSD transform_cert_args(LLPointer<LLCertificate> cert);
+void general_cert_done(const LLSD& notification, const LLSD& response);
+void trust_cert_done(const LLSD& notification, const LLSD& response);
void apply_udp_blacklist(const std::string& csv);
bool process_login_success_response();
void transition_back_to_login_panel(const std::string& emsg);
@@ -364,7 +367,7 @@ bool idle_startup()
if ( STATE_FIRST == LLStartUp::getStartupState() )
{
- gViewerWindow->showCursor();
+ gViewerWindow->showCursor();
gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
/////////////////////////////////////////////////
@@ -662,69 +665,25 @@ bool idle_startup()
//
// Log on to system
//
- if (!LLStartUp::sSLURLCommand.empty())
- {
- // this might be a secondlife:///app/login URL
- gLoginHandler.parseDirectLogin(LLStartUp::sSLURLCommand);
- }
- if (!gLoginHandler.getFirstName().empty()
- || !gLoginHandler.getLastName().empty()
- /*|| !gLoginHandler.getWebLoginKey().isNull()*/ )
- {
- // We have at least some login information on a SLURL
- gFirstname = gLoginHandler.getFirstName();
- gLastname = gLoginHandler.getLastName();
- LL_DEBUGS("LLStartup") << "STATE_FIRST: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
-
- // Show the login screen if we don't have everything
- show_connect_box =
- gFirstname.empty() || gLastname.empty();
- }
- else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
- {
- LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
- gFirstname = cmd_line_login[0].asString();
- gLastname = cmd_line_login[1].asString();
- LL_DEBUGS("LLStartup") << "Setting gFirstname, gLastname from gSavedSettings(\"UserLoginInfo\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
-
- LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
- char md5pass[33]; /* Flawfinder: ignore */
- pass.hex_digest(md5pass);
- gPassword = md5pass;
-
-#ifdef USE_VIEWER_AUTH
- show_connect_box = true;
-#else
- show_connect_box = false;
-#endif
- gSavedSettings.setBOOL("AutoLogin", TRUE);
- }
- else if (gSavedSettings.getBOOL("AutoLogin"))
- {
- gFirstname = gSavedSettings.getString("FirstName");
- gLastname = gSavedSettings.getString("LastName");
- LL_DEBUGS("LLStartup") << "AutoLogin: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
- gPassword = LLStartUp::loadPasswordFromDisk();
- gSavedSettings.setBOOL("RememberPassword", TRUE);
-
-#ifdef USE_VIEWER_AUTH
- show_connect_box = true;
-#else
- show_connect_box = false;
-#endif
+ if (gUserCredential.isNull())
+ {
+ gUserCredential = gLoginHandler.initializeLoginInfo();
}
- else
+ if (gUserCredential.isNull())
{
- // if not automatically logging in, display login dialog
- // a valid grid is selected
- gFirstname = gSavedSettings.getString("FirstName");
- gLastname = gSavedSettings.getString("LastName");
- LL_DEBUGS("LLStartup") << "normal login: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
- gPassword = LLStartUp::loadPasswordFromDisk();
- show_connect_box = true;
+ show_connect_box = TRUE;
+ }
+ else if (gSavedSettings.getBOOL("AutoLogin"))
+ {
+ gRememberPassword = TRUE;
+ gSavedSettings.setBOOL("RememberPassword", TRUE);
+ show_connect_box = false;
+ }
+ else
+ {
+ gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
+ show_connect_box = TRUE;
}
-
-
// Go to the next startup state
LLStartUp::setStartupState( STATE_BROWSER_INIT );
return FALSE;
@@ -756,8 +715,10 @@ bool idle_startup()
// Load all the name information out of the login view
// NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
// show the login view until login_show() is called below.
- // LLPanelLogin::getFields(gFirstname, gLastname, gPassword);
-
+ if (gUserCredential.isNull())
+ {
+ gUserCredential = gLoginHandler.initializeLoginInfo();
+ }
if (gNoRender)
{
LL_ERRS("AppInit") << "Need to autologin or use command line with norender!" << LL_ENDL;
@@ -768,8 +729,10 @@ bool idle_startup()
// Show the login dialog
login_show();
// connect dialog is already shown, so fill in the names
- LLPanelLogin::setFields( gFirstname, gLastname, gPassword);
-
+ if (gUserCredential.notNull())
+ {
+ LLPanelLogin::setFields( gUserCredential, gRememberPassword);
+ }
LLPanelLogin::giveFocus();
gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
@@ -836,42 +799,39 @@ bool idle_startup()
gViewerWindow->moveProgressViewToFront();
//reset the values that could have come in from a slurl
- // DEV-42215: Make sure they're not empty -- gFirstname and gLastname
+ // DEV-42215: Make sure they're not empty -- gUserCredential
// might already have been set from gSavedSettings, and it's too bad
// to overwrite valid values with empty strings.
- if (! gLoginHandler.getFirstName().empty() && ! gLoginHandler.getLastName().empty())
- {
- gFirstname = gLoginHandler.getFirstName();
- gLastname = gLoginHandler.getLastName();
- LL_DEBUGS("LLStartup") << "STATE_LOGIN_CLEANUP: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
- }
if (show_connect_box)
{
// TODO if not use viewer auth
// Load all the name information out of the login view
- LLPanelLogin::getFields(&gFirstname, &gLastname, &gPassword);
+ LLPanelLogin::getFields(gUserCredential, gRememberPassword);
// end TODO
// HACK: Try to make not jump on login
gKeyboard->resetKeys();
}
- if (!gFirstname.empty() && !gLastname.empty())
- {
- gSavedSettings.setString("FirstName", gFirstname);
- gSavedSettings.setString("LastName", gLastname);
-
- LL_INFOS("AppInit") << "Attempting login as: " << gFirstname << " " << gLastname << LL_ENDL;
- gDebugInfo["LoginName"] = gFirstname + " " + gLastname;
+ // save the credentials
+ std::string userid = "unknown";
+ if(gUserCredential.notNull())
+ {
+ userid = gUserCredential->userID();
+ gSecAPIHandler->saveCredential(gUserCredential, gRememberPassword);
}
-
+ gSavedSettings.setBOOL("RememberPassword", gRememberPassword);
+ LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;
+ gDebugInfo["LoginName"] = userid;
+
// create necessary directories
// *FIX: these mkdir's should error check
- gDirUtilp->setLindenUserDir(gFirstname, gLastname);
+ gDirUtilp->setLindenUserDir(userid);
LLFile::mkdir(gDirUtilp->getLindenUserDir());
-
+
// Set PerAccountSettingsFile to the default value.
+ std::string per_account_settings_file = LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount");
gSavedSettings.setString("PerAccountSettingsFile",
gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")));
@@ -900,9 +860,8 @@ bool idle_startup()
{
gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
}
+ gDirUtilp->setPerAccountChatLogsDir(userid);
- gDirUtilp->setPerAccountChatLogsDir(gFirstname, gLastname);
-
LLFile::mkdir(gDirUtilp->getChatLogsDir());
LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
@@ -923,11 +882,7 @@ bool idle_startup()
if (show_connect_box)
{
- std::string location;
- LLPanelLogin::getLocation( location );
- LLURLSimString::setString( location );
-
- // END TODO
+ LLSLURL slurl;
LLPanelLogin::closePanel();
}
@@ -951,26 +906,21 @@ bool idle_startup()
// their last location, or some URL "-url //sim/x/y[/z]"
// All accounts have both a home and a last location, and we don't support
// more locations than that. Choose the appropriate one. JC
- if (LLURLSimString::parse())
- {
- // a startup URL was specified
- agent_location_id = START_LOCATION_ID_URL;
-
- // doesn't really matter what location_which is, since
- // gAgentStartLookAt will be overwritten when the
- // UserLoginLocationReply arrives
- location_which = START_LOCATION_ID_LAST;
- }
- else if (gSavedSettings.getString("LoginLocation") == "last" )
- {
- agent_location_id = START_LOCATION_ID_LAST; // last location
- location_which = START_LOCATION_ID_LAST;
- }
- else
- {
- agent_location_id = START_LOCATION_ID_HOME; // home
- location_which = START_LOCATION_ID_HOME;
- }
+ switch (LLStartUp::getStartSLURL().getType())
+ {
+ case LLSLURL::LOCATION:
+ agent_location_id = START_LOCATION_ID_URL;
+ location_which = START_LOCATION_ID_LAST;
+ break;
+ case LLSLURL::LAST_LOCATION:
+ agent_location_id = START_LOCATION_ID_LAST;
+ location_which = START_LOCATION_ID_LAST;
+ break;
+ default:
+ agent_location_id = START_LOCATION_ID_HOME;
+ location_which = START_LOCATION_ID_HOME;
+ break;
+ }
gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
@@ -997,7 +947,7 @@ bool idle_startup()
if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
{
- gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
+ gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
// Update progress status and the display loop.
auth_desc = LLTrans::getString("LoginInProgress");
@@ -1021,11 +971,7 @@ bool idle_startup()
// This call to LLLoginInstance::connect() starts the
// authentication process.
- LLSD credentials;
- credentials["first"] = gFirstname;
- credentials["last"] = gLastname;
- credentials["passwd"] = gPassword;
- login->connect(credentials);
+ login->connect(gUserCredential);
LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
return FALSE;
@@ -1050,10 +996,11 @@ bool idle_startup()
{
LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
<< LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
+ LLSD response = LLLoginInstance::getInstance()->getResponse();
// Still have error conditions that may need some
// sort of handling.
- std::string reason_response = LLLoginInstance::getInstance()->getResponse("reason");
- std::string message_response = LLLoginInstance::getInstance()->getResponse("message");
+ std::string reason_response = response["reason"];
+ std::string message_response = response["message"];
if(!message_response.empty())
{
@@ -1073,8 +1020,8 @@ bool idle_startup()
if(reason_response == "key")
{
// Couldn't login because user/password is wrong
- // Clear the password
- gPassword = "";
+ // Clear the credential
+ gUserCredential->clearAuthenticator();
}
if(reason_response == "update"
@@ -1087,18 +1034,65 @@ bool idle_startup()
LLLoginInstance::getInstance()->disconnect();
LLAppViewer::instance()->forceQuit();
}
- else
+ else
{
- // Don't pop up a notification in the TOS case because
- // LLFloaterTOS::onCancel() already scolded the user.
- if (reason_response != "tos")
+ if (reason_response != "tos")
{
- LLSD args;
- args["ERROR_MESSAGE"] = emsg.str();
- LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
- LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+ // Don't pop up a notification in the TOS case because
+ // LLFloaterTOS::onCancel() already scolded the user.
+ std::string error_code;
+ if(response.has("errorcode"))
+ {
+ error_code = response["errorcode"].asString();
+ }
+ if ((reason_response == "CURLError") &&
+ (error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") &&
+ response.has("certificate"))
+ {
+ // This was a certificate error, so grab the certificate
+ // and throw up the appropriate dialog.
+ LLPointer<LLCertificate> certificate = gSecAPIHandler->getCertificate(response["certificate"]);
+ if(certificate)
+ {
+ LLSD args = transform_cert_args(certificate);
+
+ if(error_code == "SSL_CACERT")
+ {
+ // if we are handling an untrusted CA, throw up the dialog
+ // with the 'trust this CA' button.
+ LLNotificationsUtil::add("TrustCertificateError", args, response,
+ trust_cert_done);
+
+ show_connect_box = true;
+ }
+ else
+ {
+ // the certificate exception returns a unique string for each type of exception.
+ // we grab this string via the LLUserAuth object, and use that to grab the localized
+ // string.
+ args["REASON"] = LLTrans::getString(message_response);
+
+ LLNotificationsUtil::add("GeneralCertificateError", args, response,
+ general_cert_done);
+
+ reset_login();
+ gSavedSettings.setBOOL("AutoLogin", FALSE);
+ show_connect_box = true;
+
+ }
+
+ }
+ }
+ else
+ {
+ // This wasn't a certificate error, so throw up the normal
+ // notificatioin message.
+ LLSD args;
+ args["ERROR_MESSAGE"] = emsg.str();
+ LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+ LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+ }
}
-
//setup map of datetime strings to codes and slt & local time offset from utc
// *TODO: Does this need to be here?
LLStringOps::setupDatetimeInfo (false);
@@ -1111,7 +1105,12 @@ bool idle_startup()
if(process_login_success_response())
{
// Pass the user information to the voice chat server interface.
- gVoiceClient->userAuthorized(gFirstname, gLastname, gAgentID);
+ LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
+ // create the default proximal channel
+ LLVoiceChannel::initClass();
+ // update the voice settings
+ LLVoiceClient::getInstance()->updateSettings();
+ LLGridManager::getInstance()->setFavorite();
LLStartUp::setStartupState( STATE_WORLD_INIT);
}
else
@@ -1122,6 +1121,7 @@ bool idle_startup()
LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
transition_back_to_login_panel(emsg.str());
show_connect_box = true;
+ return FALSE;
}
}
return FALSE;
@@ -1807,9 +1807,12 @@ bool idle_startup()
// thus, do not show this alert.
if (!gAgent.isFirstLogin())
{
- bool url_ok = LLURLSimString::sInstance.parse();
- if ((url_ok && gAgentStartLocation == "url") ||
- (!url_ok && ((gAgentStartLocation == gSavedSettings.getString("LoginLocation")))))
+ llinfos << "gAgentStartLocation : " << gAgentStartLocation << llendl;
+ LLSLURL start_slurl = LLStartUp::getStartSLURL();
+
+ if (((start_slurl.getType() == LLSLURL::LOCATION) && (gAgentStartLocation == "url")) ||
+ ((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) ||
+ ((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home")))
{
// Start location is OK
// Disabled code to restore camera location and focus if logging in to default location
@@ -1831,17 +1834,23 @@ bool idle_startup()
else
{
std::string msg;
- if (url_ok)
+ switch(start_slurl.getType())
{
- msg = "AvatarMovedDesired";
- }
- else if (gSavedSettings.getString("LoginLocation") == "home")
- {
- msg = "AvatarMovedHome";
- }
- else
- {
- msg = "AvatarMovedLast";
+ case LLSLURL::LOCATION:
+ {
+
+ msg = "AvatarMovedDesired";
+ break;
+ }
+ case LLSLURL::HOME_LOCATION:
+ {
+ msg = "AvatarMovedHome";
+ break;
+ }
+ default:
+ {
+ msg = "AvatarMovedLast";
+ }
}
LLNotificationsUtil::add(msg);
}
@@ -2057,20 +2066,9 @@ void login_show()
#endif
LLPanelLogin::show( gViewerWindow->getWindowRectScaled(),
- bUseDebugLogin,
+ bUseDebugLogin || gSavedSettings.getBOOL("SecondLifeEnterprise"),
login_callback, NULL );
- // UI textures have been previously loaded in doPreloadImages()
-
- LL_DEBUGS("AppInit") << "Setting Servers" << LL_ENDL;
-
- LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel(), LLViewerLogin::getInstance()->getGridChoice());
-
- LLViewerLogin* vl = LLViewerLogin::getInstance();
- for(int grid_index = GRID_INFO_ADITI; grid_index < GRID_INFO_OTHER; ++grid_index)
- {
- LLPanelLogin::addServer(vl->getKnownGridLabel((EGridInfo)grid_index), grid_index);
- }
}
// Callback for when login screen is closed. Option 0 = connect, option 1 = quit.
@@ -2086,9 +2084,6 @@ void login_callback(S32 option, void *userdata)
}
else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
{
- // Make sure we don't save the password if the user is trying to clear it.
- std::string first, last, password;
- LLPanelLogin::getFields(&first, &last, &password);
if (!gSavedSettings.getBOOL("RememberPassword"))
{
// turn off the setting and write out to disk
@@ -2111,142 +2106,6 @@ void login_callback(S32 option, void *userdata)
}
}
-
-// static
-std::string LLStartUp::loadPasswordFromDisk()
-{
- // Only load password if we also intend to save it (otherwise the user
- // wonders what we're doing behind his back). JC
- BOOL remember_password = gSavedSettings.getBOOL("RememberPassword");
- if (!remember_password)
- {
- return std::string("");
- }
-
- std::string hashed_password("");
-
- // Look for legacy "marker" password from settings.ini
- hashed_password = gSavedSettings.getString("Marker");
- if (!hashed_password.empty())
- {
- // Stomp the Marker entry.
- gSavedSettings.setString("Marker", "");
-
- // Return that password.
- return hashed_password;
- }
-
- std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- "password.dat");
- LLFILE* fp = LLFile::fopen(filepath, "rb"); /* Flawfinder: ignore */
- if (!fp)
- {
- return hashed_password;
- }
-
- // UUID is 16 bytes, written into ASCII is 32 characters
- // without trailing \0
- const S32 HASHED_LENGTH = 32;
- U8 buffer[HASHED_LENGTH+1];
-
- if (1 != fread(buffer, HASHED_LENGTH, 1, fp))
- {
- return hashed_password;
- }
-
- fclose(fp);
-
- // Decipher with MAC address
- LLXORCipher cipher(gMACAddress, 6);
- cipher.decrypt(buffer, HASHED_LENGTH);
-
- buffer[HASHED_LENGTH] = '\0';
-
- // Check to see if the mac address generated a bad hashed
- // password. It should be a hex-string or else the mac adress has
- // changed. This is a security feature to make sure that if you
- // get someone's password.dat file, you cannot hack their account.
- if(is_hex_string(buffer, HASHED_LENGTH))
- {
- hashed_password.assign((char*)buffer);
- }
-
- return hashed_password;
-}
-
-
-// static
-void LLStartUp::savePasswordToDisk(const std::string& hashed_password)
-{
- std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- "password.dat");
- LLFILE* fp = LLFile::fopen(filepath, "wb"); /* Flawfinder: ignore */
- if (!fp)
- {
- return;
- }
-
- // Encipher with MAC address
- const S32 HASHED_LENGTH = 32;
- U8 buffer[HASHED_LENGTH+1];
-
- LLStringUtil::copy((char*)buffer, hashed_password.c_str(), HASHED_LENGTH+1);
-
- LLXORCipher cipher(gMACAddress, 6);
- cipher.encrypt(buffer, HASHED_LENGTH);
-
- if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1)
- {
- LL_WARNS("AppInit") << "Short write" << LL_ENDL;
- }
-
- fclose(fp);
-}
-
-
-// static
-void LLStartUp::deletePasswordFromDisk()
-{
- std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- "password.dat");
- LLFile::remove(filepath);
-}
-
-
-bool is_hex_string(U8* str, S32 len)
-{
- bool rv = true;
- U8* c = str;
- while(rv && len--)
- {
- switch(*c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- ++c;
- break;
- default:
- rv = false;
- break;
- }
- }
- return rv;
-}
-
void show_first_run_dialog()
{
LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
@@ -2288,7 +2147,7 @@ bool login_alert_status(const LLSD& notification, const LLSD& response)
// break;
case 2: // Teleport
// Restart the login process, starting at our home locaton
- LLURLSimString::setString("home");
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
break;
default:
@@ -2508,30 +2367,35 @@ void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S3
const std::string COMMON_GESTURES_FOLDER = "Common Gestures";
const std::string MALE_GESTURES_FOLDER = "Male Gestures";
const std::string FEMALE_GESTURES_FOLDER = "Female Gestures";
-const std::string MALE_OUTFIT_FOLDER = "Male Shape & Outfit";
-const std::string FEMALE_OUTFIT_FOLDER = "Female Shape & Outfit";
const S32 OPT_CLOSED_WINDOW = -1;
const S32 OPT_MALE = 0;
const S32 OPT_FEMALE = 1;
-
+const S32 OPT_TRUST_CERT = 0;
+const S32 OPT_CANCEL_TRUST = 1;
+
bool callback_choose_gender(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+{
+
+ // These defaults are returned from the server on login. They are set in login.xml.
+ // If no default is returned from the server, they are retrieved from settings.xml.
+
+ S32 option = LLNotification::getSelectedOption(notification, response);
switch(option)
{
- case OPT_MALE:
- LLStartUp::loadInitialOutfit( MALE_OUTFIT_FOLDER, "male" );
- break;
-
- case OPT_FEMALE:
- case OPT_CLOSED_WINDOW:
- default:
- LLStartUp::loadInitialOutfit( FEMALE_OUTFIT_FOLDER, "female" );
- break;
+ case OPT_MALE:
+ LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
+ break;
+
+ case OPT_FEMALE:
+ case OPT_CLOSED_WINDOW:
+ default:
+ LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
+ break;
}
return false;
}
+
void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
const std::string& gender_name )
{
@@ -2746,7 +2610,6 @@ void reset_login()
//---------------------------------------------------------------------------
-std::string LLStartUp::sSLURLCommand;
bool LLStartUp::canGoFullscreen()
{
@@ -2779,41 +2642,145 @@ void LLStartUp::fontInit()
bool LLStartUp::dispatchURL()
{
// ok, if we've gotten this far and have a startup URL
- if (!sSLURLCommand.empty())
+ if (!getStartSLURL().isValid())
{
- LLMediaCtrl* web = NULL;
- const bool trusted_browser = false;
- LLURLDispatcher::dispatch(sSLURLCommand, web, trusted_browser);
+ return false;
}
- else if (LLURLSimString::parse())
- {
+ if(getStartSLURL().getType() != LLSLURL::APP)
+ {
+
// If we started with a location, but we're already
// at that location, don't pop dialogs open.
LLVector3 pos = gAgent.getPositionAgent();
- F32 dx = pos.mV[VX] - (F32)LLURLSimString::sInstance.mX;
- F32 dy = pos.mV[VY] - (F32)LLURLSimString::sInstance.mY;
+ LLVector3 slurlpos = getStartSLURL().getPosition();
+ F32 dx = pos.mV[VX] - slurlpos.mV[VX];
+ F32 dy = pos.mV[VY] - slurlpos.mV[VY];
const F32 SLOP = 2.f; // meters
- if( LLURLSimString::sInstance.mSimName != gAgent.getRegion()->getName()
+ if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
|| (dx*dx > SLOP*SLOP)
|| (dy*dy > SLOP*SLOP) )
{
- std::string url = LLURLSimString::getURL();
- LLMediaCtrl* web = NULL;
- const bool trusted_browser = false;
- LLURLDispatcher::dispatch(url, web, trusted_browser);
+ LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(),
+ NULL, false);
}
return true;
}
return false;
}
+void LLStartUp::setStartSLURL(const LLSLURL& slurl)
+{
+ sStartSLURL = slurl;
+ switch(slurl.getType())
+ {
+ case LLSLURL::HOME_LOCATION:
+ {
+ gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_HOME);
+ break;
+ }
+ case LLSLURL::LAST_LOCATION:
+ {
+ gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_LAST);
+ break;
+ }
+ default:
+ LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
+ break;
+ }
+}
+
bool login_alert_done(const LLSD& notification, const LLSD& response)
{
LLPanelLogin::giveFocus();
return false;
}
+// parse the certificate information into args for the
+// certificate notifications
+LLSD transform_cert_args(LLPointer<LLCertificate> cert)
+{
+ LLSD args = LLSD::emptyMap();
+ std::string value;
+ LLSD cert_info = cert->getLLSD();
+ // convert all of the elements in the cert into
+ // args for the xml dialog, so we have flexability to
+ // display various parts of the cert by only modifying
+ // the cert alert dialog xml.
+ for(LLSD::map_iterator iter = cert_info.beginMap();
+ iter != cert_info.endMap();
+ iter++)
+ {
+ // key usage and extended key usage
+ // are actually arrays, and we want to format them as comma separated
+ // strings, so special case those.
+ LLSDSerialize::toXML(cert_info[iter->first], std::cout);
+ if((iter->first== std::string(CERT_KEY_USAGE)) |
+ (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
+ {
+ value = "";
+ LLSD usage = cert_info[iter->first];
+ for (LLSD::array_iterator usage_iter = usage.beginArray();
+ usage_iter != usage.endArray();
+ usage_iter++)
+ {
+
+ if(usage_iter != usage.beginArray())
+ {
+ value += ", ";
+ }
+
+ value += (*usage_iter).asString();
+ }
+
+ }
+ else
+ {
+ value = iter->second.asString();
+ }
+
+ std::string name = iter->first;
+ std::transform(name.begin(), name.end(), name.begin(),
+ (int(*)(int))toupper);
+ args[name.c_str()] = value;
+ }
+ return args;
+}
+
+
+// when we handle a cert error, give focus back to the login panel
+void general_cert_done(const LLSD& notification, const LLSD& response)
+{
+ LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+ LLPanelLogin::giveFocus();
+}
+
+// check to see if the user wants to trust the cert.
+// if they do, add it to the cert store and
+void trust_cert_done(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case OPT_TRUST_CERT:
+ {
+ LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
+ LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));
+ store->add(cert);
+ store->save();
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ break;
+ }
+ case OPT_CANCEL_TRUST:
+ reset_login();
+ gSavedSettings.setBOOL("AutoLogin", FALSE);
+ LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+ default:
+ LLPanelLogin::giveFocus();
+ break;
+ }
+
+}
void apply_udp_blacklist(const std::string& csv)
{
@@ -2861,33 +2828,45 @@ bool process_login_success_response()
text = response["secure_session_id"].asString();
if(!text.empty()) gAgent.mSecureSessionID.set(text);
- text = response["first_name"].asString();
- if(!text.empty())
- {
- // Remove quotes from string. Login.cgi sends these to force
- // names that look like numbers into strings.
- gFirstname.assign(text);
- LLStringUtil::replaceChar(gFirstname, '"', ' ');
- LLStringUtil::trim(gFirstname);
- }
- text = response["last_name"].asString();
- if(!text.empty())
+ // if the response contains a display name, use that,
+ // otherwise if the response contains a first and/or last name,
+ // use those. Otherwise use the credential identifier
+
+ gDisplayName = "";
+ if (response.has("display_name"))
{
- gLastname.assign(text);
+ gDisplayName.assign(response["display_name"].asString());
+ if(!gDisplayName.empty())
+ {
+ // Remove quotes from string. Login.cgi sends these to force
+ // names that look like numbers into strings.
+ LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+ LLStringUtil::trim(gDisplayName);
+ }
}
- gSavedSettings.setString("FirstName", gFirstname);
- gSavedSettings.setString("LastName", gLastname);
-
- if (gSavedSettings.getBOOL("RememberPassword"))
+ if(gDisplayName.empty())
{
- // Successful login means the password is valid, so save it.
- LLStartUp::savePasswordToDisk(gPassword);
+ if(response.has("first_name"))
+ {
+ gDisplayName.assign(response["first_name"].asString());
+ LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+ LLStringUtil::trim(gDisplayName);
+ }
+ if(response.has("last_name"))
+ {
+ text.assign(response["last_name"].asString());
+ LLStringUtil::replaceChar(text, '"', ' ');
+ LLStringUtil::trim(text);
+ if(!gDisplayName.empty())
+ {
+ gDisplayName += " ";
+ }
+ gDisplayName += text;
+ }
}
- else
+ if(gDisplayName.empty())
{
- // Don't leave password from previous session sitting around
- // during this login session.
- LLStartUp::deletePasswordFromDisk();
+ gDisplayName.assign(gUserCredential->asString());
}
// this is their actual ability to access content
@@ -2981,7 +2960,7 @@ bool process_login_success_response()
// replace the default help URL format
gSavedSettings.setString("HelpURLFormat",text);
- // don't fall back to Nebraska's pre-connection static help
+ // don't fall back to Standalone's pre-connection static help
gSavedSettings.setBOOL("HelpUseLocal", false);
}
@@ -3044,6 +3023,37 @@ bool process_login_success_response()
LLStringOps::setupDatetimeInfo(pacific_daylight_time);
}
+ // set up the voice configuration. Ultimately, we should pass this up as part of each voice
+ // channel if we need to move to multiple voice servers per grid.
+ LLSD voice_config_info = response["voice-config"];
+ if(voice_config_info.has("VoiceServerType"))
+ {
+ gSavedSettings.setString("VoiceServerType", voice_config_info["VoiceServerType"].asString());
+ }
+
+ // Request the map server url
+ std::string map_server_url = response["map-server-url"];
+ if(!map_server_url.empty())
+ {
+ gSavedSettings.setString("MapServerURL", map_server_url);
+ }
+
+ // Default male and female avatars allowing the user to choose their avatar on first login.
+ // These may be passed up by SLE to allow choice of enterprise avatars instead of the standard
+ // "new ruth." Not to be confused with 'initial-outfit' below
+ LLSD newuser_config = response["newuser-config"];
+ if(newuser_config.has("DefaultFemaleAvatar"))
+ {
+ gSavedSettings.setString("DefaultFemaleAvatar", newuser_config["DefaultFemaleAvatar"].asString());
+ }
+ if(newuser_config.has("DefaultMaleAvatar"))
+ {
+ gSavedSettings.setString("DefaultMaleAvatar", newuser_config["DefaultMaleAvatar"].asString());
+ }
+
+ // Initial outfit for the user.
+ // QUESTION: Why can't we simply simply set the users outfit directly
+ // from a web page into the user info on the server? - Roxie
LLSD initial_outfit = response["initial-outfit"][0];
if(initial_outfit.size())
{
@@ -3097,7 +3107,7 @@ bool process_login_success_response()
bool success = false;
// JC: gesture loading done below, when we have an asset system
- // in place. Don't delete/clear user_credentials until then.
+ // in place. Don't delete/clear gUserCredentials until then.
if(gAgentID.notNull()
&& gAgentSessionID.notNull()
&& gMessageSystem->mOurCircuitCode
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index 92fe9521d3..16cc74504f 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -38,6 +38,7 @@
class LLViewerTexture ;
class LLEventPump;
class LLStartupListener;
+class LLSLURL;
// functions
bool idle_startup();
@@ -101,26 +102,18 @@ public:
static void loadInitialOutfit( const std::string& outfit_folder_name,
const std::string& gender_name );
- // Load MD5 of user's password from local disk file.
- static std::string loadPasswordFromDisk();
-
- // Record MD5 of user's password for subsequent login.
- static void savePasswordToDisk(const std::string& hashed_password);
-
- // Delete the saved password local disk file.
- static void deletePasswordFromDisk();
static bool dispatchURL();
// if we have a SLURL or sim string ("Ahern/123/45") that started
// the viewer, dispatch it
- static std::string sSLURLCommand;
- // *HACK: On startup, if we were passed a secondlife://app/do/foo
- // command URL, store it for later processing.
-
static void postStartupState();
+ static void setStartSLURL(const LLSLURL& slurl);
+ static LLSLURL& getStartSLURL() { return sStartSLURL; }
private:
+ static LLSLURL sStartSLURL;
+
static std::string startupStateToString(EStartupState state);
static EStartupState gStartupState; // Do not set directly, use LLStartup::setStartupState
static boost::scoped_ptr<LLEventPump> sStateWatcher;
diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp
index 61705c4eb3..8fab3bb361 100644
--- a/indra/newview/llstylemap.cpp
+++ b/indra/newview/llstylemap.cpp
@@ -51,7 +51,7 @@ const LLStyle::Params &LLStyleMap::lookupAgent(const LLUUID &source)
style_params.color.control = "HTMLLinkColor";
style_params.readonly_color.control = "HTMLLinkColor";
style_params.link_href =
- LLSLURL::buildCommand("agent", source, "inspect");
+ LLSLURL("agent", source, "inspect").getSLURLString();
}
else
{
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index cbb030836e..cb65756764 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -56,14 +56,11 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(N
mChannel(NULL),
mMessageList(NULL),
mSysWellChiclet(NULL),
- mSeparator(NULL),
NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"),
IM_WELL_ANCHOR_NAME("im_well_panel"),
mIsReshapedByUser(false)
{
- mTypedItemsCount[IT_NOTIFICATION] = 0;
- mTypedItemsCount[IT_INSTANT_MESSAGE] = 0;
setOverlapsScreenChannel(true);
}
@@ -75,18 +72,6 @@ BOOL LLSysWellWindow::postBuild()
// get a corresponding channel
initChannel();
- LLPanel::Params params;
- mSeparator = LLUICtrlFactory::create<LLPanel>(params);
- LLUICtrlFactory::instance().buildPanel(mSeparator, "panel_separator.xml");
-
- LLRect rc = mSeparator->getRect();
- rc.setOriginAndSize(0, 0, mMessageList->getItemsRect().getWidth(), rc.getHeight());
- mSeparator->setRect(rc);
- mSeparator->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
- mSeparator->setVisible(FALSE);
-
- mMessageList->addItem(mSeparator);
-
// click on SysWell Window should clear "new message" state (and 'Lit' status). EXT-3147.
// mouse up callback is not called in this case.
setMouseDownCallback(boost::bind(&LLSysWellWindow::releaseNewMessagesState, this));
@@ -130,7 +115,7 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id)
{
if(mMessageList->removeItemByValue(id))
{
- handleItemRemoved(IT_NOTIFICATION);
+ mSysWellChiclet->updateWidget(isWindowEmpty());
reshapeWindow();
}
else
@@ -258,76 +243,7 @@ void LLSysWellWindow::releaseNewMessagesState()
//---------------------------------------------------------------------------------
bool LLSysWellWindow::isWindowEmpty()
{
- // keep in mind, mSeparator is always in the list
- return mMessageList->size() == 1;
-}
-
-// *TODO: mantipov: probably is deprecated
-void LLSysWellWindow::handleItemAdded(EItemType added_item_type)
-{
- bool should_be_shown = ++mTypedItemsCount[added_item_type] == 1 && anotherTypeExists(added_item_type);
-
- if (should_be_shown && !mSeparator->getVisible())
- {
- mSeparator->setVisible(TRUE);
-
- // refresh list to recalculate mSeparator position
- mMessageList->reshape(mMessageList->getRect().getWidth(), mMessageList->getRect().getHeight());
- }
-
- //fix for EXT-3254
- //set limits for min_height.
- S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight();
-
- std::vector<LLPanel*> items;
- mMessageList->getItems(items);
-
- if(items.size()>1)//first item is separator
- {
- S32 min_height;
- S32 min_width;
- getResizeLimits(&min_width,&min_height);
-
- min_height = items[1]->getRect().getHeight() + 2 * mMessageList->getBorderWidth() + parent_list_delta_height;
-
- setResizeLimits(min_width,min_height);
- }
- mSysWellChiclet->updateWidget(isWindowEmpty());
-}
-
-void LLSysWellWindow::handleItemRemoved(EItemType removed_item_type)
-{
- bool should_be_hidden = --mTypedItemsCount[removed_item_type] == 0;
-
- if (should_be_hidden && mSeparator->getVisible())
- {
- mSeparator->setVisible(FALSE);
-
- // refresh list to recalculate mSeparator position
- mMessageList->reshape(mMessageList->getRect().getWidth(), mMessageList->getRect().getHeight());
- }
- mSysWellChiclet->updateWidget(isWindowEmpty());
-}
-
-bool LLSysWellWindow::anotherTypeExists(EItemType item_type)
-{
- bool exists = false;
- switch(item_type)
- {
- case IT_INSTANT_MESSAGE:
- if (mTypedItemsCount[IT_NOTIFICATION] > 0)
- {
- exists = true;
- }
- break;
- case IT_NOTIFICATION:
- if (mTypedItemsCount[IT_INSTANT_MESSAGE] > 0)
- {
- exists = true;
- }
- break;
- }
- return exists;
+ return mMessageList->size() == 0;
}
/************************************************************************/
@@ -559,8 +475,7 @@ void LLNotificationWellWindow::addItem(LLSysWellItem::Params p)
LLSysWellItem* new_item = new LLSysWellItem(p);
if (mMessageList->addItem(new_item, value, ADD_TOP))
{
- handleItemAdded(IT_NOTIFICATION);
-
+ mSysWellChiclet->updateWidget(isWindowEmpty());
reshapeWindow();
new_item->setOnItemCloseCallback(boost::bind(&LLNotificationWellWindow::onItemClose, this, _1));
@@ -755,9 +670,9 @@ void LLIMWellWindow::addIMRow(const LLUUID& sessionId, S32 chicletCounter,
const std::string& name, const LLUUID& otherParticipantId)
{
RowPanel* item = new RowPanel(this, sessionId, chicletCounter, name, otherParticipantId);
- if (mMessageList->insertItemAfter(mSeparator, item, sessionId))
+ if (mMessageList->addItem(item, sessionId))
{
- handleItemAdded(IT_INSTANT_MESSAGE);
+ mSysWellChiclet->updateWidget(isWindowEmpty());
}
else
{
@@ -782,7 +697,7 @@ void LLIMWellWindow::delIMRow(const LLUUID& sessionId)
if (mMessageList->removeItemByValue(sessionId))
{
- handleItemRemoved(IT_INSTANT_MESSAGE);
+ mSysWellChiclet->updateWidget(isWindowEmpty());
}
else
{
@@ -810,9 +725,9 @@ void LLIMWellWindow::addObjectRow(const LLUUID& notification_id, bool new_messag
if (mMessageList->getItemByValue(notification_id) == NULL)
{
ObjectRowPanel* item = new ObjectRowPanel(notification_id, new_message);
- if (mMessageList->insertItemAfter(mSeparator, item, notification_id))
+ if (mMessageList->addItem(item, notification_id))
{
- handleItemAdded(IT_INSTANT_MESSAGE);
+ mSysWellChiclet->updateWidget(isWindowEmpty());
}
else
{
@@ -827,7 +742,7 @@ void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id)
{
if (mMessageList->removeItemByValue(notification_id))
{
- handleItemRemoved(IT_INSTANT_MESSAGE);
+ mSysWellChiclet->updateWidget(isWindowEmpty());
}
else
{
diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h
index 296bdf7482..c8215c71ee 100644
--- a/indra/newview/llsyswellwindow.h
+++ b/indra/newview/llsyswellwindow.h
@@ -82,20 +82,12 @@ public:
protected:
- typedef enum{
- IT_NOTIFICATION,
- IT_INSTANT_MESSAGE
- }EItemType;
-
// gets a rect that bounds possible positions for the SysWellWindow on a screen (EXT-1111)
void getAllowedRect(LLRect& rect);
// init Window's channel
virtual void initChannel();
- void handleItemAdded(EItemType added_item_type);
- void handleItemRemoved(EItemType removed_item_type);
- bool anotherTypeExists(EItemType item_type) ;
const std::string NOTIFICATION_WELL_ANCHOR_NAME;
const std::string IM_WELL_ANCHOR_NAME;
@@ -113,15 +105,6 @@ protected:
*/
LLSysWellChiclet* mSysWellChiclet;
- /**
- * Special panel which is used as separator of Notifications & IM Rows.
- * It is always presents in the list and shown when it is necessary.
- * It should be taken into account when reshaping and checking list size
- */
- LLPanel* mSeparator;
-
- typedef std::map<EItemType, S32> typed_items_count_t;
- typed_items_count_t mTypedItemsCount;
bool mIsReshapedByUser;
};
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 4262264a1d..82fa672342 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -178,7 +178,7 @@ BOOL LLTexLayerSetBuffer::needsRender()
BOOL needs_update = (mNeedsUpdate || upload_now) && !gAgentAvatarp->mAppearanceAnimating;
if (needs_update)
{
- BOOL invalid_skirt = gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT);
+ BOOL invalid_skirt = gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT);
if (invalid_skirt)
{
// we were trying to create a skirt texture
@@ -1848,7 +1848,7 @@ U32 LLTexLayerTemplate::updateWearableCache()
//this isn't a cloneable layer
return 0;
}
- EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te);
+ LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te);
U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
U32 added = 0;
for (U32 i = 0; i < num_wearables; i++)
diff --git a/indra/newview/lltexlayerparams.cpp b/indra/newview/lltexlayerparams.cpp
index 5e5d344461..35acf883c7 100644
--- a/indra/newview/lltexlayerparams.cpp
+++ b/indra/newview/lltexlayerparams.cpp
@@ -234,8 +234,8 @@ BOOL LLTexLayerParamAlpha::getSkip() const
}
}
- EWearableType type = (EWearableType)getWearableType();
- if ((type != WT_INVALID) && !avatar->isWearingWearableType(type))
+ LLWearableType::EType type = (LLWearableType::EType)getWearableType();
+ if ((type != LLWearableType::WT_INVALID) && !avatar->isWearingWearableType(type))
{
return TRUE;
}
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index df79725474..9ad2322765 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -401,7 +401,8 @@ bool LLTextureCacheRemoteWorker::doRead()
// Second state / stage : identify the cache or not...
if (!done && (mState == CACHE))
{
- idx = mCache->getHeaderCacheEntry(mID, mImageSize);
+ LLTextureCache::Entry entry ;
+ idx = mCache->getHeaderCacheEntry(mID, entry);
if (idx < 0)
{
// The texture is *not* cached. We're done here...
@@ -410,6 +411,7 @@ bool LLTextureCacheRemoteWorker::doRead()
}
else
{
+ mImageSize = entry.mImageSize ;
// If the read offset is bigger than the header cache, we read directly from the body
// Note that currently, we *never* read with offset from the cache, so the result is *always* HEADER
mState = mOffset < TEXTURE_CACHE_ENTRY_SIZE ? HEADER : BODY;
@@ -531,13 +533,14 @@ bool LLTextureCacheRemoteWorker::doRead()
bool LLTextureCacheRemoteWorker::doWrite()
{
bool done = false;
- S32 idx = -1;
+ S32 idx = -1;
// First state / stage : check that what we're trying to cache is in an OK shape
if (mState == INIT)
{
llassert_always(mOffset == 0); // We currently do not support write offsets
llassert_always(mDataSize > 0); // Things will go badly wrong if mDataSize is nul or negative...
+ llassert_always(mImageSize >= mDataSize);
mState = CACHE;
}
@@ -547,14 +550,19 @@ bool LLTextureCacheRemoteWorker::doWrite()
if (!done && (mState == CACHE))
{
bool alreadyCached = false;
- S32 cur_imagesize = 0;
+ LLTextureCache::Entry entry ;
+
// Checks if this image is already in the entry list
- idx = mCache->getHeaderCacheEntry(mID, cur_imagesize);
- if (idx >= 0 && (cur_imagesize > 0))
+ idx = mCache->getHeaderCacheEntry(mID, entry);
+ if(idx < 0)
+ {
+ idx = mCache->setHeaderCacheEntry(mID, entry, mImageSize, mDataSize); // create the new entry.
+ }
+ else
{
- alreadyCached = true; // already there and non empty
+ alreadyCached = mCache->updateEntry(idx, entry, mImageSize, mDataSize); // update the existing entry.
}
- idx = mCache->setHeaderCacheEntry(mID, mImageSize); // create or touch the entry
+
if (idx < 0)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -564,10 +572,6 @@ bool LLTextureCacheRemoteWorker::doWrite()
}
else
{
- if (cur_imagesize > 0 && (mImageSize != cur_imagesize))
- {
- alreadyCached = false; // re-write the header if the size changed in all cases
- }
if (alreadyCached && (mDataSize <= TEXTURE_CACHE_ENTRY_SIZE))
{
// Small texture already cached case: we're done with writing
@@ -630,7 +634,7 @@ bool LLTextureCacheRemoteWorker::doWrite()
{
llassert(mDataSize > TEXTURE_CACHE_ENTRY_SIZE); // wouldn't make sense to be here otherwise...
S32 file_size = mDataSize - TEXTURE_CACHE_ENTRY_SIZE;
- if ((file_size > 0) && mCache->updateTextureEntryList(mID, file_size))
+
{
// build the cache file name from the UUID
std::string filename = mCache->getTextureFileName(mID);
@@ -648,10 +652,7 @@ bool LLTextureCacheRemoteWorker::doWrite()
done = true;
}
}
- else
- {
- mDataSize = 0; // no data written
- }
+
// Nothing else to do at that point...
done = true;
}
@@ -825,53 +826,6 @@ std::string LLTextureCache::getTextureFileName(const LLUUID& id)
return filename;
}
-bool LLTextureCache::updateTextureEntryList(const LLUUID& id, S32 bodysize)
-{
- bool res = false;
- bool purge = false;
- {
- LLMutexLock lock(&mHeaderMutex);
- size_map_t::iterator iter1 = mTexturesSizeMap.find(id);
- if (iter1 == mTexturesSizeMap.end() || iter1->second < bodysize)
- {
- llassert_always(bodysize > 0);
-
- S32 oldbodysize = 0;
- if (iter1 != mTexturesSizeMap.end())
- {
- oldbodysize = iter1->second;
- }
-
- Entry entry;
- S32 idx = openAndReadEntry(id, entry, false);
- if (idx < 0)
- {
- llwarns << "Failed to open entry: " << id << llendl;
- removeCachedTexture(id) ;
- return false;
- }
- else if (oldbodysize != entry.mBodySize)
- {
- // only happens to 64 bits systems, do not know why.
- llwarns << "Entry mismatch in mTextureSizeMap / mHeaderIDMap"
- << " idx=" << idx << " oldsize=" << oldbodysize << " entrysize=" << entry.mBodySize << llendl;
- }
- updateEntry(idx, entry, entry.mImageSize, bodysize);
-
- if (mTexturesSizeTotal > sCacheMaxTexturesSize)
- {
- purge = true;
- }
- res = true;
- }
- }
- if (purge)
- {
- mDoPurge = TRUE;
- }
- return res;
-}
-
//debug
BOOL LLTextureCache::isInCache(const LLUUID& id)
{
@@ -1207,55 +1161,64 @@ void LLTextureCache::updateEntryTimeStamp(S32 idx, Entry& entry)
{
if (!mReadOnly)
{
- llassert_always(entry.mImageSize > entry.mBodySize);
-
entry.mTime = time(NULL);
mUpdatedEntryMap[idx] = entry ;
}
}
}
-//mHeaderMutex is locked before calling this.
//update an existing entry, write to header file immediately.
-void LLTextureCache::updateEntry(S32 idx, Entry& entry, S32 new_image_size, S32 new_body_size)
+bool LLTextureCache::updateEntry(S32 idx, Entry& entry, S32 new_image_size, S32 new_data_size)
{
- llassert_always(new_image_size > -1) ;
-
+ S32 new_body_size = llmax(0, new_data_size - TEXTURE_CACHE_ENTRY_SIZE) ;
+
if(new_image_size == entry.mImageSize && new_body_size == entry.mBodySize)
{
- updateEntryTimeStamp(idx, entry) ; //nothing changed.
+ return true ; //nothing changed.
}
- else if (idx >= 0)
+ else
{
- if (!mReadOnly)
- {
- llassert_always(new_image_size > new_body_size) ;
+ bool purge = false ;
- bool update_header = false ;
- if(entry.mImageSize < 0) //is a brand-new entry
- {
- mHeaderIDMap[entry.mID] = idx;
- mTexturesSizeMap[entry.mID] = new_body_size ;
- mTexturesSizeTotal += new_body_size ;
-
- // Update Header
- update_header = true ;
- }
- else if (entry.mBodySize != new_body_size)
- {
- //already in mHeaderIDMap.
- mTexturesSizeMap[entry.mID] = new_body_size ;
- mTexturesSizeTotal -= entry.mBodySize ;
- mTexturesSizeTotal += new_body_size ;
- }
- entry.mTime = time(NULL);
- entry.mImageSize = new_image_size ;
- entry.mBodySize = new_body_size ;
+ lockHeaders() ;
+
+ bool update_header = false ;
+ if(entry.mImageSize < 0) //is a brand-new entry
+ {
+ mHeaderIDMap[entry.mID] = idx;
+ mTexturesSizeMap[entry.mID] = new_body_size ;
+ mTexturesSizeTotal += new_body_size ;
-// llinfos << "Updating TE: " << idx << ": " << id << " Size: " << entry.mBodySize << " Time: " << entry.mTime << llendl;
- writeEntryToHeaderImmediately(idx, entry, update_header) ;
+ // Update Header
+ update_header = true ;
+ }
+ else if (entry.mBodySize != new_body_size)
+ {
+ //already in mHeaderIDMap.
+ mTexturesSizeMap[entry.mID] = new_body_size ;
+ mTexturesSizeTotal -= entry.mBodySize ;
+ mTexturesSizeTotal += new_body_size ;
+ }
+ entry.mTime = time(NULL);
+ entry.mImageSize = new_image_size ;
+ entry.mBodySize = new_body_size ;
+
+ writeEntryToHeaderImmediately(idx, entry, update_header) ;
+
+ if (mTexturesSizeTotal > sCacheMaxTexturesSize)
+ {
+ purge = true;
+ }
+
+ unlockHeaders() ;
+
+ if (purge)
+ {
+ mDoPurge = TRUE;
}
}
+
+ return false ;
}
U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
@@ -1658,39 +1621,37 @@ LLTextureCacheWorker* LLTextureCache::getWriter(handle_t handle)
// Called from work thread
// Reads imagesize from the header, updates timestamp
-S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, S32& imagesize)
+S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, Entry& entry)
{
- LLMutexLock lock(&mHeaderMutex);
- Entry entry;
+ LLMutexLock lock(&mHeaderMutex);
S32 idx = openAndReadEntry(id, entry, false);
if (idx >= 0)
- {
- imagesize = entry.mImageSize;
+ {
updateEntryTimeStamp(idx, entry); // updates time
}
return idx;
}
// Writes imagesize to the header, updates timestamp
-S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, S32 imagesize)
+S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize)
{
mHeaderMutex.lock();
- llassert_always(imagesize >= 0);
- Entry entry;
S32 idx = openAndReadEntry(id, entry, true);
+ mHeaderMutex.unlock();
+
if (idx >= 0)
{
- updateEntry(idx, entry, imagesize, entry.mBodySize);
- mHeaderMutex.unlock();
+ updateEntry(idx, entry, imagesize, datasize);
}
else // retry
{
- mHeaderMutex.unlock();
readHeaderCache(); // We couldn't write an entry, so refresh the LRU
+
mHeaderMutex.lock();
llassert_always(!mLRU.empty() || mHeaderEntriesInfo.mEntries < sCacheMaxEntries);
mHeaderMutex.unlock();
- idx = setHeaderCacheEntry(id, imagesize); // assert above ensures no inf. recursion
+
+ idx = setHeaderCacheEntry(id, entry, imagesize, datasize); // assert above ensures no inf. recursion
}
return idx;
}
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h
index 5dc06ff401..0fceee3011 100644
--- a/indra/newview/lltexturecache.h
+++ b/indra/newview/lltexturecache.h
@@ -144,7 +144,6 @@ public:
protected:
// Accessed by LLTextureCacheWorker
- bool updateTextureEntryList(const LLUUID& id, S32 size);
std::string getLocalFileName(const LLUUID& id);
std::string getTextureFileName(const LLUUID& id);
void addCompleted(Responder* responder, bool success);
@@ -162,7 +161,7 @@ private:
void readEntriesHeader();
void writeEntriesHeader();
S32 openAndReadEntry(const LLUUID& id, Entry& entry, bool create);
- void updateEntry(S32 idx, Entry& entry, S32 new_image_size, S32 new_body_size);
+ bool updateEntry(S32 idx, Entry& entry, S32 new_image_size, S32 new_body_size);
void updateEntryTimeStamp(S32 idx, Entry& entry) ;
U32 openAndReadEntries(std::vector<Entry>& entries);
void writeEntriesAndClose(const std::vector<Entry>& entries);
@@ -170,8 +169,8 @@ private:
void writeEntryToHeaderImmediately(S32 idx, Entry& entry, bool write_header = false) ;
void removeEntry(S32 idx, Entry& entry, std::string& filename);
void removeCachedTexture(const LLUUID& id) ;
- S32 getHeaderCacheEntry(const LLUUID& id, S32& imagesize);
- S32 setHeaderCacheEntry(const LLUUID& id, S32 imagesize);
+ S32 getHeaderCacheEntry(const LLUUID& id, Entry& entry);
+ S32 setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize);
void writeUpdatedEntries() ;
void updatedHeaderEntriesFile() ;
void lockHeaders() { mHeaderMutex.lock(); }
diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp
index add61c00cf..7eac3867d5 100644
--- a/indra/newview/lltoastgroupnotifypanel.cpp
+++ b/indra/newview/lltoastgroupnotifypanel.cpp
@@ -133,9 +133,8 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification
childSetActionTextbox("attachment", boost::bind(
&LLToastGroupNotifyPanel::onClickAttachment, this));
- LLUIImagePtr attachIconImg = get_item_icon(mInventoryOffer->mType,
- LLInventoryType::IT_TEXTURE,
- 0, FALSE);
+ LLUIImagePtr attachIconImg = LLInventoryIcon::getIcon(mInventoryOffer->mType,
+ LLInventoryType::IT_TEXTURE);
pAttachIcon->setValue(attachIconImg->getName());
}
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 089163929e..9275ca4f42 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -291,7 +291,10 @@ LLToastNotifyPanel::~LLToastNotifyPanel()
{
// let reusable notification be deleted
mNotification->setReusable(false);
- LLNotifications::getInstance()->cancel(mNotification);
+ if (!mNotification->isPersistent())
+ {
+ LLNotifications::getInstance()->cancel(mNotification);
+ }
}
}
diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp
index ab65ead4c5..83a5839a93 100644
--- a/indra/newview/llurl.cpp
+++ b/indra/newview/llurl.cpp
@@ -286,5 +286,11 @@ const char * LLURL::getFullPath()
return(sReturnString);
}
+const char * LLURL::getAuthority()
+{
+ strncpy(LLURL::sReturnString,mAuthority, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
+ return(sReturnString);
+}
char LLURL::sReturnString[LL_MAX_PATH] = "";
diff --git a/indra/newview/llurl.h b/indra/newview/llurl.h
index 9a089dd835..e41b83d29f 100644
--- a/indra/newview/llurl.h
+++ b/indra/newview/llurl.h
@@ -79,6 +79,7 @@ public:
virtual const char *getFQURL() const;
virtual const char *getFullPath();
+ virtual const char *getAuthority();
virtual const char *updateRelativePath(const LLURL &url);
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index b88069cd48..a31c3a0f1b 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -4,7 +4,7 @@
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
- * Copyright (c) 2007-2009, Linden Research, Inc.
+ * Copyright (c) 2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +12,12 @@
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -45,10 +44,10 @@
#include "llsidetray.h"
#include "llslurl.h"
#include "llstartup.h" // gStartupState
-#include "llurlsimstring.h"
#include "llweb.h"
#include "llworldmapmessage.h"
#include "llurldispatcherlistener.h"
+#include "llviewernetwork.h"
// library includes
#include "llnotificationsutil.h"
@@ -59,25 +58,25 @@ static LLURLDispatcherListener sURLDispatcherListener;
class LLURLDispatcherImpl
{
public:
- static bool dispatch(const std::string& url,
+ static bool dispatch(const LLSLURL& slurl,
LLMediaCtrl* web,
bool trusted_browser);
// returns true if handled or explicitly blocked.
- static bool dispatchRightClick(const std::string& url);
+ static bool dispatchRightClick(const LLSLURL& slurl);
private:
- static bool dispatchCore(const std::string& url,
+ static bool dispatchCore(const LLSLURL& slurl,
bool right_mouse,
LLMediaCtrl* web,
bool trusted_browser);
// handles both left and right click
- static bool dispatchHelp(const std::string& url, bool right_mouse);
+ static bool dispatchHelp(const LLSLURL& slurl, bool right_mouse);
// Handles sl://app.floater.html.help by showing Help floater.
// Returns true if handled.
- static bool dispatchApp(const std::string& url,
+ static bool dispatchApp(const LLSLURL& slurl,
bool right_mouse,
LLMediaCtrl* web,
bool trusted_browser);
@@ -85,16 +84,16 @@ private:
// by showing panel in Search floater.
// Returns true if handled or explicitly blocked.
- static bool dispatchRegion(const std::string& url, bool right_mouse);
+ static bool dispatchRegion(const LLSLURL& slurl, bool right_mouse);
// handles secondlife://Ahern/123/45/67/
// Returns true if handled.
- static void regionHandleCallback(U64 handle, const std::string& url,
+ static void regionHandleCallback(U64 handle, const LLSLURL& slurl,
const LLUUID& snapshot_id, bool teleport);
// Called by LLWorldMap when a location has been resolved to a
// region name
- static void regionNameCallback(U64 handle, const std::string& url,
+ static void regionNameCallback(U64 handle, const LLSLURL& slurl,
const LLUUID& snapshot_id, bool teleport);
// Called by LLWorldMap when a region name has been resolved to a
// location in-world, used by places-panel display.
@@ -103,65 +102,57 @@ private:
};
// static
-bool LLURLDispatcherImpl::dispatchCore(const std::string& url,
+bool LLURLDispatcherImpl::dispatchCore(const LLSLURL& slurl,
bool right_mouse,
LLMediaCtrl* web,
bool trusted_browser)
{
- if (url.empty()) return false;
- //if (dispatchHelp(url, right_mouse)) return true;
- if (dispatchApp(url, right_mouse, web, trusted_browser)) return true;
- if (dispatchRegion(url, right_mouse)) return true;
+ //if (dispatchHelp(slurl, right_mouse)) return true;
+ switch(slurl.getType())
+ {
+ case LLSLURL::APP:
+ return dispatchApp(slurl, right_mouse, web, trusted_browser);
+ case LLSLURL::LOCATION:
+ return dispatchRegion(slurl, right_mouse);
+ default:
+ return false;
+ }
/*
// Inform the user we can't handle this
std::map<std::string, std::string> args;
- args["SLURL"] = url;
+ args["SLURL"] = slurl;
r;
*/
-
- return false;
}
// static
-bool LLURLDispatcherImpl::dispatch(const std::string& url,
+bool LLURLDispatcherImpl::dispatch(const LLSLURL& slurl,
LLMediaCtrl* web,
bool trusted_browser)
{
- llinfos << "url: " << url << llendl;
const bool right_click = false;
- return dispatchCore(url, right_click, web, trusted_browser);
+ return dispatchCore(slurl, right_click, web, trusted_browser);
}
// static
-bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url)
+bool LLURLDispatcherImpl::dispatchRightClick(const LLSLURL& slurl)
{
- llinfos << "url: " << url << llendl;
const bool right_click = true;
LLMediaCtrl* web = NULL;
const bool trusted_browser = false;
- return dispatchCore(url, right_click, web, trusted_browser);
+ return dispatchCore(slurl, right_click, web, trusted_browser);
}
// static
-bool LLURLDispatcherImpl::dispatchApp(const std::string& url,
+bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
bool right_mouse,
LLMediaCtrl* web,
bool trusted_browser)
{
- // ensure the URL is in the secondlife:///app/ format
- if (!LLSLURL::isSLURLCommand(url))
- {
- return false;
- }
-
- LLURI uri(url);
- LLSD pathArray = uri.pathArray();
- pathArray.erase(0); // erase "app"
- std::string cmd = pathArray.get(0);
- pathArray.erase(0); // erase "cmd"
+ llinfos << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << llendl;
bool handled = LLCommandDispatcher::dispatch(
- cmd, pathArray, uri.queryMap(), web, trusted_browser);
+ slurl.getAppCmd(), slurl.getAppPath(), slurl.getAppQuery(), web, trusted_browser);
// alert if we didn't handle this secondlife:///app/ SLURL
// (but still return true because it is a valid app SLURL)
@@ -173,81 +164,72 @@ bool LLURLDispatcherImpl::dispatchApp(const std::string& url,
}
// static
-bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mouse)
+bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, bool right_mouse)
{
- if (!LLSLURL::isSLURL(url))
- {
- return false;
- }
-
- std::string sim_string = LLSLURL::stripProtocol(url);
- std::string region_name;
- S32 x = 128;
- S32 y = 128;
- S32 z = 0;
- if (! LLURLSimString::parse(sim_string, &region_name, &x, &y, &z))
- {
- return false;
- }
-
+ if(slurl.getType() != LLSLURL::LOCATION)
+ {
+ return false;
+ }
// Before we're logged in, need to update the startup screen
// to tell the user where they are going.
if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
{
- // Parse it and stash in globals, it will be dispatched in
- // STATE_CLEANUP.
- LLURLSimString::setString(url);
// We're at the login screen, so make sure user can see
// the login location box to know where they are going.
- LLPanelLogin::refreshLocation( true );
+ LLPanelLogin::setLocation(slurl);
return true;
}
// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
- //LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
- //if(url_displayp) url_displayp->setName(region_name);
+ //LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+ //if(slurl_displayp) slurl_displayp->setName(region_name);
// Request a region handle by name
- LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
- LLURLDispatcherImpl::regionNameCallback,
- url,
- false); // don't teleport
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
+ LLURLDispatcherImpl::regionNameCallback,
+ slurl.getSLURLString(),
+ false); // don't teleport
return true;
}
/*static*/
-void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
+void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{
- std::string sim_string = LLSLURL::stripProtocol(url);
- std::string region_name;
- S32 x = 128;
- S32 y = 128;
- S32 z = 0;
-
- if (LLURLSimString::parse(sim_string, &region_name, &x, &y, &z))
- {
- regionHandleCallback(region_handle, url, snapshot_id, teleport);
- }
+
+ if(slurl.getType() == LLSLURL::LOCATION)
+ {
+ regionHandleCallback(region_handle, slurl, snapshot_id, teleport);
+ }
}
/* static */
-void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
+void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{
- std::string sim_string = LLSLURL::stripProtocol(url);
- std::string region_name;
- S32 x = 128;
- S32 y = 128;
- S32 z = 0;
- LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
-
- LLVector3 local_pos;
- local_pos.mV[VX] = (F32)x;
- local_pos.mV[VY] = (F32)y;
- local_pos.mV[VZ] = (F32)z;
+ // we can't teleport cross grid at this point
+ if((!LLGridManager::getInstance()->isSystemGrid(slurl.getGrid()) || !LLGridManager::getInstance()->isSystemGrid()) &&
+ (slurl.getGrid() != LLGridManager::getInstance()->getGrid()))
+ {
+ LLSD args;
+ args["SLURL"] = slurl.getLocationString();
+ args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
+ LLSD grid_info = LLGridManager::getInstance()->getGridInfo(slurl.getGrid());
+
+ if(grid_info.has(GRID_LABEL_VALUE))
+ {
+ args["GRID"] = grid_info[GRID_LABEL_VALUE].asString();
+ }
+ else
+ {
+ args["GRID"] = slurl.getGrid();
+ }
+ LLNotificationsUtil::add("CantTeleportToGrid", args);
+ return;
+ }
+
LLVector3d global_pos = from_region_handle(region_handle);
- global_pos += LLVector3d(local_pos);
+ global_pos += LLVector3d(slurl.getPosition());
if (teleport)
{
@@ -271,8 +253,8 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str
// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
// // display informational floater, allow user to click teleport btn
-// LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
-// if(url_displayp)
+// LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+// if(slurl_displayp)
// {
// url_displayp->displayParcelInfo(region_handle, local_pos);
// if(snapshot_id.notNull())
@@ -287,7 +269,7 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str
//---------------------------------------------------------------------------
// Teleportation links are handled here because they are tightly coupled
-// to URL parsing and sim-fragment parsing
+// to SLURL parsing and sim-fragment parsing
class LLTeleportHandler : public LLCommandHandler
{
public:
@@ -303,18 +285,21 @@ public:
// a global position, and teleport to it
if (tokens.size() < 1) return false;
- // Region names may be %20 escaped.
- std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]);
-
- // build secondlife://De%20Haro/123/45/67 for use in callback
- std::string url = LLSLURL::PREFIX_SECONDLIFE;
- for (int i = 0; i < tokens.size(); ++i)
+ LLVector3 coords(128, 128, 0);
+ if (tokens.size() <= 4)
{
- url += tokens[i].asString() + "/";
+ coords = LLVector3(tokens[1].asReal(),
+ tokens[2].asReal(),
+ tokens[3].asReal());
}
+
+ // Region names may be %20 escaped.
+
+ std::string region_name = LLURI::unescape(tokens[0]);
+
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
LLURLDispatcherImpl::regionHandleCallback,
- url,
+ LLSLURL(region_name, coords).getSLURLString(),
true); // teleport
return true;
}
@@ -324,21 +309,21 @@ LLTeleportHandler gTeleportHandler;
//---------------------------------------------------------------------------
// static
-bool LLURLDispatcher::dispatch(const std::string& url,
+bool LLURLDispatcher::dispatch(const std::string& slurl,
LLMediaCtrl* web,
bool trusted_browser)
{
- return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
+ return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
}
// static
-bool LLURLDispatcher::dispatchRightClick(const std::string& url)
+bool LLURLDispatcher::dispatchRightClick(const std::string& slurl)
{
- return LLURLDispatcherImpl::dispatchRightClick(url);
+ return LLURLDispatcherImpl::dispatchRightClick(LLSLURL(slurl));
}
// static
-bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url)
+bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
{
// *NOTE: Text editors are considered sources of trusted URLs
// in order to make avatar profile links in chat history work.
@@ -348,5 +333,7 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url)
// *TODO: Make this trust model more refined. JC
const bool trusted_browser = true;
LLMediaCtrl* web = NULL;
- return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
+ return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
}
+
+
diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h
index ff8a351253..407e417e58 100644
--- a/indra/newview/llurldispatcher.h
+++ b/indra/newview/llurldispatcher.h
@@ -2,9 +2,9 @@
* @file llurldispatcher.h
* @brief Central registry for all SL URL handlers
*
- * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
*
- * Copyright (c) 2007-2009, Linden Research, Inc.
+ * Copyright (c) 2007-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +12,12 @@
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -31,16 +30,16 @@
*/
#ifndef LLURLDISPATCHER_H
#define LLURLDISPATCHER_H
-
class LLMediaCtrl;
class LLURLDispatcher
{
public:
- static bool dispatch(const std::string& url,
+
+ static bool dispatch(const std::string& slurl,
LLMediaCtrl* web,
- bool trusted_browser);
+ bool trusted_browser);
// At startup time and on clicks in internal web browsers,
// teleport, open map, or run requested command.
// @param url
@@ -54,9 +53,9 @@ public:
// that navigates to trusted (Linden Lab) pages.
// Returns true if someone handled the URL.
- static bool dispatchRightClick(const std::string& url);
+ static bool dispatchRightClick(const std::string& slurl);
- static bool dispatchFromTextEditor(const std::string& url);
+ static bool dispatchFromTextEditor(const std::string& slurl);
};
#endif
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 1d2687a8c2..8488527185 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -89,7 +89,7 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length));
LLWString text_to_copy;
- if (LLSLURL::isSLURL(unescaped_text))
+ if (LLSLURL(unescaped_text).isValid())
text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text));
else
text_to_copy = utf8str_to_wstring(unescaped_text);
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 9559311e3c..1094f030bf 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -157,21 +157,21 @@ void audio_update_volume(bool force_update)
LLViewerMedia::setVolume( media_muted ? 0.0f : media_volume );
// Voice
- if (gVoiceClient)
+ if (LLVoiceClient::getInstance())
{
F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
voice_volume = mute_volume * master_volume * voice_volume;
BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
- gVoiceClient->setVoiceVolume(voice_mute ? 0.f : voice_volume);
- gVoiceClient->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
+ LLVoiceClient::getInstance()->setVoiceVolume(voice_mute ? 0.f : voice_volume);
+ LLVoiceClient::getInstance()->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
{
- gVoiceClient->setMuteMic(true);
+ LLVoiceClient::getInstance()->setMuteMic(true);
}
else
{
- gVoiceClient->setMuteMic(false);
+ LLVoiceClient::getInstance()->setMuteMic(false);
}
}
}
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index ee3b27c8da..514f72c334 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -443,7 +443,7 @@ bool handleVelocityInterpolate(const LLSD& newvalue)
bool handleForceShowGrid(const LLSD& newvalue)
{
- LLPanelLogin::refreshLocation( false );
+ LLPanelLogin::updateServer( );
return true;
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f0800e82e7..3482ac508e 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -731,6 +731,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
{
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
LLMemType mt_ss(LLMemType::MTYPE_DISPLAY_STATE_SORT);
+ gPipeline.sAllowRebuildPriorityGroup = TRUE ;
gPipeline.stateSort(*LLViewerCamera::getInstance(), result);
stop_glerror();
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index b39ee8b2e0..49748c59e8 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -36,7 +36,6 @@
#include "llnotificationsutil.h"
#include "llsdserialize.h"
#include "message.h"
-#include "indra_constants.h"
#include "llagent.h"
#include "llagentcamera.h"
@@ -299,10 +298,14 @@ void LLViewerInventoryItem::fetchFromServer(void) const
// we have to check region. It can be null after region was destroyed. See EXT-245
if (region)
{
- if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString())
- url = region->getCapability("FetchLib");
- else
- url = region->getCapability("FetchInventory");
+ if(gAgent.getID() != mPermissions.getOwner())
+ {
+ url = region->getCapability("FetchLib");
+ }
+ else
+ {
+ url = region->getCapability("FetchInventory");
+ }
}
else
{
@@ -587,7 +590,7 @@ bool LLViewerInventoryCategory::fetch()
std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
if (!url.empty()) //Capability found. Build up LLSD and use it.
{
- LLInventoryModelBackgroundFetch::instance().start(mUUID);
+ LLInventoryModelBackgroundFetch::instance().start(mUUID, false);
}
else
{ //Deprecated, but if we don't have a capability, use the old system.
@@ -724,8 +727,8 @@ void LLViewerInventoryCategory::determineFolderType()
return;
if (item->isWearableType())
{
- const EWearableType wearable_type = item->getWearableType();
- const std::string& wearable_name = LLWearableDictionary::getTypeName(wearable_type);
+ const LLWearableType::EType wearable_type = item->getWearableType();
+ const std::string& wearable_name = LLWearableType::getTypeName(wearable_type);
U64 valid_folder_types = LLViewerFolderType::lookupValidFolderTypes(wearable_name);
folder_valid |= valid_folder_types;
folder_invalid |= ~valid_folder_types;
@@ -909,7 +912,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
const LLUUID& parent, const LLTransactionID& transaction_id,
const std::string& name,
const std::string& desc, LLAssetType::EType asset_type,
- LLInventoryType::EType inv_type, EWearableType wtype,
+ LLInventoryType::EType inv_type, LLWearableType::EType wtype,
U32 next_owner_perm,
LLPointer<LLInventoryCallback> cb)
{
@@ -1196,10 +1199,10 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons
else
{
// Use for all clothing and body parts. Adding new wearable types requires updating LLWearableDictionary.
- EWearableType wearable_type = LLWearableDictionary::typeNameToType(type_name);
- if (wearable_type >= WT_SHAPE && wearable_type < WT_COUNT)
+ LLWearableType::EType wearable_type = LLWearableType::typeNameToType(type_name);
+ if (wearable_type >= LLWearableType::WT_SHAPE && wearable_type < LLWearableType::WT_COUNT)
{
- LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(wearable_type);
+ LLAssetType::EType asset_type = LLWearableType::getAssetType(wearable_type);
LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(asset_type);
const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(folder_type);
LLFolderBridge::createWearable(parent_id, wearable_type);
@@ -1537,14 +1540,14 @@ bool LLViewerInventoryItem::isWearableType() const
return (getInventoryType() == LLInventoryType::IT_WEARABLE);
}
-EWearableType LLViewerInventoryItem::getWearableType() const
+LLWearableType::EType LLViewerInventoryItem::getWearableType() const
{
if (!isWearableType())
{
llwarns << "item is not a wearable" << llendl;
- return WT_INVALID;
+ return LLWearableType::WT_INVALID;
}
- return EWearableType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
+ return LLWearableType::EType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
}
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index f296ce35ff..f0dc7bcb67 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -74,7 +74,7 @@ public:
virtual const LLSaleInfo& getSaleInfo() const;
virtual LLInventoryType::EType getInventoryType() const;
virtual bool isWearableType() const;
- virtual EWearableType getWearableType() const;
+ virtual LLWearableType::EType getWearableType() const;
virtual U32 getFlags() const;
virtual time_t getCreationDate() const;
virtual U32 getCRC32() const; // really more of a checksum.
@@ -310,14 +310,14 @@ public:
extern LLInventoryCallbackManager gInventoryCallbacks;
-#define NOT_WEARABLE (EWearableType)0
+#define NOT_WEARABLE (LLWearableType::EType)0
// *TODO: Find a home for these
void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
const LLUUID& parent, const LLTransactionID& transaction_id,
const std::string& name,
const std::string& desc, LLAssetType::EType asset_type,
- LLInventoryType::EType inv_type, EWearableType wtype,
+ LLInventoryType::EType inv_type, LLWearableType::EType wtype,
U32 next_owner_perm,
LLPointer<LLInventoryCallback> cb);
diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp
index c1e851350b..02e450b223 100644
--- a/indra/newview/llviewermediafocus.cpp
+++ b/indra/newview/llviewermediafocus.cpp
@@ -215,6 +215,8 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal,
// We need the aspect ratio, and the 3 components of the bbox as height, width, and depth.
F32 aspect_ratio = getBBoxAspectRatio(bbox, normal, &height, &width, &depth);
F32 camera_aspect = LLViewerCamera::getInstance()->getAspect();
+
+ lldebugs << "normal = " << normal << ", aspect_ratio = " << aspect_ratio << ", camera_aspect = " << camera_aspect << llendl;
// We will normally use the side of the volume aligned with the short side of the screen (i.e. the height for
// a screen in a landscape aspect ratio), however there is an edge case where the aspect ratio of the object is
@@ -231,11 +233,15 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal,
{
angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect());
distance = width * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
+
+ lldebugs << "using width (" << width << "), angle_of_view = " << angle_of_view << ", distance = " << distance << llendl;
}
else
{
angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView());
distance = height * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
+
+ lldebugs << "using height (" << height << "), angle_of_view = " << angle_of_view << ", distance = " << distance << llendl;
}
distance += depth * 0.5;
@@ -440,40 +446,38 @@ F32 LLViewerMediaFocus::getBBoxAspectRatio(const LLBBox& bbox, const LLVector3&
LLVector3 bbox_max = bbox.getExtentLocal();
F32 dot1 = 0.f;
F32 dot2 = 0.f;
+
+ lldebugs << "bounding box local size = " << bbox_max << ", local_normal = " << local_normal << llendl;
// The largest component of the localized normal vector is the depth component
// meaning that the other two are the legs of the rectangle.
local_normal.abs();
- if(local_normal.mV[VX] > local_normal.mV[VY])
+
+ // Using temporary variables for these makes the logic a bit more readable.
+ bool XgtY = (local_normal.mV[VX] > local_normal.mV[VY]);
+ bool XgtZ = (local_normal.mV[VX] > local_normal.mV[VZ]);
+ bool YgtZ = (local_normal.mV[VY] > local_normal.mV[VZ]);
+
+ if(XgtY && XgtZ)
{
- if(local_normal.mV[VX] > local_normal.mV[VZ])
- {
- // Use the y and z comps
- comp1.mV[VY] = bbox_max.mV[VY];
- comp2.mV[VZ] = bbox_max.mV[VZ];
- *depth = bbox_max.mV[VX];
- }
- else
- {
- // Use the x and y comps
- comp1.mV[VY] = bbox_max.mV[VY];
- comp2.mV[VZ] = bbox_max.mV[VZ];
- *depth = bbox_max.mV[VZ];
- }
+ lldebugs << "x component of normal is longest, using y and z" << llendl;
+ comp1.mV[VY] = bbox_max.mV[VY];
+ comp2.mV[VZ] = bbox_max.mV[VZ];
+ *depth = bbox_max.mV[VX];
}
- else if(local_normal.mV[VY] > local_normal.mV[VZ])
+ else if(!XgtY && YgtZ)
{
- // Use the x and z comps
+ lldebugs << "y component of normal is longest, using x and z" << llendl;
comp1.mV[VX] = bbox_max.mV[VX];
comp2.mV[VZ] = bbox_max.mV[VZ];
*depth = bbox_max.mV[VY];
}
else
{
- // Use the x and y comps
- comp1.mV[VY] = bbox_max.mV[VY];
- comp2.mV[VZ] = bbox_max.mV[VZ];
- *depth = bbox_max.mV[VX];
+ lldebugs << "z component of normal is longest, using x and y" << llendl;
+ comp1.mV[VX] = bbox_max.mV[VX];
+ comp2.mV[VY] = bbox_max.mV[VY];
+ *depth = bbox_max.mV[VZ];
}
// The height is the vector closest to vertical in the bbox coordinate space (highest dot product value)
@@ -483,12 +487,20 @@ F32 LLViewerMediaFocus::getBBoxAspectRatio(const LLBBox& bbox, const LLVector3&
{
*height = comp1.length();
*width = comp2.length();
+
+ lldebugs << "comp1 = " << comp1 << ", height = " << *height << llendl;
+ lldebugs << "comp2 = " << comp2 << ", width = " << *width << llendl;
}
else
{
*height = comp2.length();
*width = comp1.length();
+
+ lldebugs << "comp2 = " << comp2 << ", height = " << *height << llendl;
+ lldebugs << "comp1 = " << comp1 << ", width = " << *width << llendl;
}
+
+ lldebugs << "returning " << (*width / *height) << llendl;
// Return the aspect ratio.
return *width / *height;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 7464423f55..42428bab03 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -430,7 +430,7 @@ void init_menus()
gPopupMenuView->setBackgroundColor( color );
// If we are not in production, use a different color to make it apparent.
- if (LLViewerLogin::getInstance()->isInProductionGrid())
+ if (LLGridManager::getInstance()->isInProductionGrid())
{
color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
}
@@ -446,7 +446,7 @@ void init_menus()
menu_bar_holder->addChild(gMenuBarView);
gViewerWindow->setMenuBackgroundColor(false,
- LLViewerLogin::getInstance()->isInProductionGrid());
+ LLGridManager::getInstance()->isInProductionGrid());
// Assume L$10 for now, the server will tell us the real cost at login
// *TODO:Also fix cost in llfolderview.cpp for Inventory menus
@@ -3468,7 +3468,7 @@ void set_god_level(U8 god_level)
if(gViewerWindow)
{
gViewerWindow->setMenuBackgroundColor(god_level > GOD_NOT,
- LLViewerLogin::getInstance()->isInProductionGrid());
+ LLGridManager::getInstance()->isInProductionGrid());
}
LLSD args;
@@ -3508,7 +3508,7 @@ BOOL check_toggle_hacked_godmode(void*)
bool enable_toggle_hacked_godmode(void*)
{
- return !LLViewerLogin::getInstance()->isInProductionGrid();
+ return !LLGridManager::getInstance()->isInProductionGrid();
}
#endif
@@ -4381,7 +4381,7 @@ BOOL enable_take()
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& gAgent.isGodlike())
{
return TRUE;
@@ -4994,7 +4994,7 @@ bool enable_object_delete()
TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- (!LLViewerLogin::getInstance()->isInProductionGrid()
+ (!LLGridManager::getInstance()->isInProductionGrid()
&& gAgent.isGodlike()) ||
# endif
LLSelectMgr::getInstance()->canDoDelete();
@@ -6638,7 +6638,7 @@ bool enable_object_take_copy()
all_valid = true;
#ifndef HACKED_GODLIKE_VIEWER
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (LLViewerLogin::getInstance()->isInProductionGrid()
+ if (LLGridManager::getInstance()->isInProductionGrid()
|| !gAgent.isGodlike())
# endif
{
@@ -6700,7 +6700,7 @@ BOOL enable_save_into_inventory(void*)
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& gAgent.isGodlike())
{
return TRUE;
@@ -7474,8 +7474,8 @@ class LLEditEnableTakeOff : public view_listener_t
bool handleEvent(const LLSD& userdata)
{
std::string clothing = userdata.asString();
- EWearableType type = LLWearableDictionary::typeNameToType(clothing);
- if (type >= WT_SHAPE && type < WT_COUNT)
+ LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
+ if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT)
return LLAgentWearables::selfHasWearable(type);
return false;
}
@@ -7490,8 +7490,8 @@ class LLEditTakeOff : public view_listener_t
LLWearableBridge::removeAllClothesFromAvatar();
else
{
- EWearableType type = LLWearableDictionary::typeNameToType(clothing);
- if (type >= WT_SHAPE && type < WT_COUNT)
+ LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
+ if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT)
{
// MULTI-WEARABLES
LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(gAgentWearables.getWearableInventoryItem(type,0));
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 5dd9623955..86e040692c 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -796,7 +796,7 @@ private:
mSelectedItems.clear();
if (mActivePanel)
{
- mActivePanel->getRootFolder()->getSelectionList(mSelectedItems);
+ mSelectedItems = mActivePanel->getRootFolder()->getSelectionList();
}
mSelectedItems.erase(mMoveIntoFolderID);
}
@@ -829,8 +829,7 @@ private:
}
// get selected items (without destination folder)
- selected_items_t selected_items;
- mActivePanel->getRootFolder()->getSelectionList(selected_items);
+ selected_items_t selected_items = mActivePanel->getRootFolder()->getSelectionList();
selected_items.erase(mMoveIntoFolderID);
// compare stored & current sets of selected items
@@ -1237,7 +1236,6 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id,
bool matches(const LLNotificationPtr notification) const
{
if(notification->getName() == "ObjectGiveItem"
- || notification->getName() == "ObjectGiveItemUnknownUser"
|| notification->getName() == "UserGiveItem")
{
return (notification->getPayload()["from_id"].asUUID() == blocked_id);
@@ -1700,7 +1698,6 @@ void LLOfferInfo::initRespondFunctionMap()
if(mRespondFunctions.empty())
{
mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
- mRespondFunctions["ObjectGiveItemUnknownUser"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2);
}
}
@@ -1771,30 +1768,6 @@ void inventory_offer_handler(LLOfferInfo* info)
return;
}
- // Name cache callbacks don't store userdata, so can't save
- // off the LLOfferInfo. Argh.
- BOOL name_found = FALSE;
- if (info->mFromGroup)
- {
- std::string group_name;
- if (gCacheName->getGroupName(info->mFromID, group_name))
- {
- args["FIRST"] = group_name;
- args["LAST"] = "";
- name_found = TRUE;
- }
- }
- else
- {
- std::string first_name, last_name;
- if (gCacheName->getName(info->mFromID, first_name, last_name))
- {
- args["FIRST"] = first_name;
- args["LAST"] = last_name;
- name_found = TRUE;
- }
- }
-
// If mObjectID is null then generate the object_id based on msg to prevent
// multiple creation of chiclets for same object.
LLUUID object_id = info->mObjectID;
@@ -1809,9 +1782,9 @@ void inventory_offer_handler(LLOfferInfo* info)
payload["give_inventory_notification"] = FALSE;
args["OBJECTFROMNAME"] = info->mFromName;
args["NAME"] = info->mFromName;
- args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
+ args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString();
std::string verb = "select?name=" + LLURI::escape(msg);
- args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str());
+ args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
LLNotification::Params p("ObjectGiveItem");
@@ -1823,9 +1796,9 @@ void inventory_offer_handler(LLOfferInfo* info)
// Note: sets inventory_task_offer_callback as the callback
p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
info->mPersist = true;
- p.name = name_found ? "ObjectGiveItem" : "ObjectGiveItemUnknownUser";
+ p.name = "ObjectGiveItem";
// Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory.
- LLNotifications::instance().add(p);
+ LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE);
}
else // Agent -> Agent Inventory Offer
{
@@ -2354,7 +2327,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
LLSD args;
args["MESSAGE"] = message;
- LLNotificationsUtil::add("JoinGroup", args, payload, join_group_response);
+ // we shouldn't pass callback functor since it is registered in LLFunctorRegistration
+ LLNotificationsUtil::add("JoinGroup", args, payload);
}
}
break;
@@ -2540,10 +2514,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
query_string["groupowned"] = "true";
}
- std::ostringstream link;
- link << "secondlife:///app/objectim/" << session_id << LLURI::mapToQueryString(query_string);
-
- chat.mURL = link.str();
+ chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString();
chat.mText = message;
// Note: lie to Nearby Chat, pretending that this is NOT an IM, because
@@ -2638,7 +2609,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
LLSD args;
// *TODO: Translate -> [FIRST] [LAST] (maybe)
- args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
+ args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
args["MESSAGE"] = message;
args["MATURITY_STR"] = region_access_str;
args["MATURITY_ICON"] = region_access_icn;
@@ -2710,7 +2681,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
else
{
- args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
+ args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
if(message.empty())
{
//support for frienship offers from clients before July 2008
@@ -3474,7 +3445,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
{
// Chat the "back" SLURL. (DEV-4907)
- LLSD substitution = LLSD().with("[T_SLURL]", gAgent.getTeleportSourceSLURL());
+ LLSLURL slurl;
+ gAgent.getTeleportSourceSLURL(slurl);
+ LLSD substitution = LLSD().with("[T_SLURL]", slurl.getSLURLString());
std::string completed_from = LLAgent::sTeleportProgressMessages["completed_from"];
LLStringUtil::format(completed_from, substitution);
@@ -5875,7 +5848,9 @@ void send_group_notice(const LLUUID& group_id,
bool handle_lure_callback(const LLSD& notification, const LLSD& response)
{
std::string text = response["message"].asString();
- text.append("\r\n").append(LLAgentUI::buildSLURL());
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl);
+ text.append("\r\n").append(slurl.getSLURLString());
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if(0 == option)
@@ -6318,7 +6293,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
LLFloaterBuyLand::updateEstateName(estate_name);
std::string owner_name =
- LLSLURL::buildCommand("agent", estate_owner_id, "inspect");
+ LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
LLPanelLandCovenant::updateEstateOwnerName(owner_name);
LLFloaterBuyLand::updateEstateOwnerName(owner_name);
@@ -6498,3 +6473,4 @@ void LLOfferInfo::forceResponse(InventoryOfferResponse response)
params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
LLNotifications::instance().forceResponse(params, response);
}
+
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index 987d23630a..a160572f7a 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -5,7 +5,7 @@
*
* $LicenseInfo:firstyear=2006&license=viewergpl$
*
- * Copyright (c) 2006-2009, Linden Research, Inc.
+ * Copyright (c) 2006-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,13 +13,12 @@
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -34,303 +33,477 @@
#include "llviewerprecompiledheaders.h"
#include "llviewernetwork.h"
+#include "llviewercontrol.h"
+#include "llsdserialize.h"
+#include "llsecapi.h"
+#include "llweb.h"
-#include "llevents.h"
-#include "net.h"
+
+const char* DEFAULT_LOGIN_PAGE = "http://secondlife.com/app/login/";
-#include "llviewercontrol.h"
-#include "lllogin.h"
+const char* SYSTEM_GRID_SLURL_BASE = "secondlife://%s/secondlife/";
+const char* MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/";
+const char* SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app";
-struct LLGridData
-{
- const char* mLabel;
- const char* mName;
- const char* mLoginURI;
- const char* mHelperURI;
-};
+const char* DEFAULT_SLURL_BASE = "https://%s/region/";
+const char* DEFAULT_APP_SLURL_BASE = "x-grid-location-info://%s/app";
-static LLGridData gGridInfo[GRID_INFO_COUNT] =
+LLGridManager::LLGridManager()
{
- { "None", "", "", ""},
- { "Aditi",
- "util.aditi.lindenlab.com",
- "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
- "http://aditi-secondlife.webdev.lindenlab.com/helpers/" },
- { "Agni",
- "util.agni.lindenlab.com",
- "https://login.agni.lindenlab.com/cgi-bin/login.cgi",
- "https://secondlife.com/helpers/" },
- { "Aruna",
- "util.aruna.lindenlab.com",
- "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
- "http://aruna-secondlife.webdev.lindenlab.com/helpers/" },
- { "Bharati",
- "util.bharati.lindenlab.com",
- "https://login.bharati.lindenlab.com/cgi-bin/login.cgi",
- "http://bharati-secondlife.webdev.lindenlab.com/helpers/" },
- { "Chandra",
- "util.chandra.lindenlab.com",
- "https://login.chandra.lindenlab.com/cgi-bin/login.cgi",
- "http://chandra-secondlife.webdev.lindenlab.com/helpers/" },
- { "Damballah",
- "util.damballah.lindenlab.com",
- "https://login.damballah.lindenlab.com/cgi-bin/login.cgi",
- "http://damballah-secondlife.webdev.lindenlab.com/helpers/" },
- { "Danu",
- "util.danu.lindenlab.com",
- "https://login.danu.lindenlab.com/cgi-bin/login.cgi",
- "http://danu-secondlife.webdev.lindenlab.com/helpers/" },
- { "Durga",
- "util.durga.lindenlab.com",
- "https://login.durga.lindenlab.com/cgi-bin/login.cgi",
- "http://durga-secondlife.webdev.lindenlab.com/helpers/" },
- { "Ganga",
- "util.ganga.lindenlab.com",
- "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",
- "http://ganga-secondlife.webdev.lindenlab.com/helpers/" },
- { "Mitra",
- "util.mitra.lindenlab.com",
- "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
- "http://mitra-secondlife.webdev.lindenlab.com/helpers/" },
- { "Mohini",
- "util.mohini.lindenlab.com",
- "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",
- "http://mohini-secondlife.webdev.lindenlab.com/helpers/" },
- { "Nandi",
- "util.nandi.lindenlab.com",
- "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",
- "http://nandi-secondlife.webdev.lindenlab.com/helpers/" },
- { "Parvati",
- "util.parvati.lindenlab.com",
- "https://login.parvati.lindenlab.com/cgi-bin/login.cgi",
- "http://parvati-secondlife.webdev.lindenlab.com/helpers/" },
- { "Radha",
- "util.radha.lindenlab.com",
- "https://login.radha.lindenlab.com/cgi-bin/login.cgi",
- "http://radha-secondlife.webdev.lindenlab.com/helpers/" },
- { "Ravi",
- "util.ravi.lindenlab.com",
- "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",
- "http://ravi-secondlife.webdev.lindenlab.com/helpers/" },
- { "Siva",
- "util.siva.lindenlab.com",
- "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
- "http://siva-secondlife.webdev.lindenlab.com/helpers/" },
- { "Shakti",
- "util.shakti.lindenlab.com",
- "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
- "http://shakti-secondlife.webdev.lindenlab.com/helpers/" },
- { "Skanda",
- "util.skanda.lindenlab.com",
- "https://login.skanda.lindenlab.com/cgi-bin/login.cgi",
- "http://skanda-secondlife.webdev.lindenlab.com/helpers/" },
- { "Soma",
- "util.soma.lindenlab.com",
- "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
- "http://soma-secondlife.webdev.lindenlab.com/helpers/" },
- { "Uma",
- "util.uma.lindenlab.com",
- "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
- "http://uma-secondlife.webdev.lindenlab.com/helpers/" },
- { "Vaak",
- "util.vaak.lindenlab.com",
- "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
- "http://vaak-secondlife.webdev.lindenlab.com/helpers/" },
- { "Yami",
- "util.yami.lindenlab.com",
- "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
- "http://yami-secondlife.webdev.lindenlab.com/helpers/" },
- { "Local",
- "localhost",
- "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
- "" },
- { "Other",
- "",
- "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
- "" }
-};
-
-const EGridInfo DEFAULT_GRID_CHOICE = GRID_INFO_AGNI;
-
-
-unsigned char gMACAddress[MAC_ADDRESS_BYTES]; /* Flawfinder: ignore */
-
-LLViewerLogin::LLViewerLogin() :
- mGridChoice(DEFAULT_GRID_CHOICE)
+ // by default, we use the 'grids.xml' file in the user settings directory
+ // this file is an LLSD file containing multiple grid definitions.
+ // This file does not contain definitions for secondlife.com grids,
+ // as that would be a security issue when they are overwritten by
+ // an attacker. Don't want someone snagging a password.
+ std::string grid_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "grids.xml");
+ initialize(grid_file);
+
+}
+
+
+LLGridManager::LLGridManager(const std::string& grid_file)
{
+ // initialize with an explicity grid file for testing.
+ initialize(grid_file);
}
- LLViewerLogin::~LLViewerLogin()
- {
- }
+//
+// LLGridManager - class for managing the list of known grids, and the current
+// selection
+//
+
-void LLViewerLogin::setGridChoice(EGridInfo grid)
-{
- if(grid < 0 || grid >= GRID_INFO_COUNT)
+//
+// LLGridManager::initialze - initialize the list of known grids based
+// on the fixed list of linden grids (fixed for security reasons)
+// the grids.xml file
+// and the command line.
+void LLGridManager::initialize(const std::string& grid_file)
+{
+ // default grid list.
+ // Don't move to a modifiable file for security reasons,
+ mGrid.clear() ;
+ // set to undefined
+ mGridList = LLSD();
+ mGridFile = grid_file;
+ // as we don't want an attacker to override our grid list
+ // to point the default grid to an invalid grid
+ addSystemGrid("None", "", "", "", DEFAULT_LOGIN_PAGE);
+
+
+
+ addSystemGrid("Agni",
+ MAINGRID,
+ "https://login.agni.lindenlab.com/cgi-bin/login.cgi",
+ "https://secondlife.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Aditi",
+ "util.aditi.lindenlab.com",
+ "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
+ "http://aditi-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Aruna",
+ "util.aruna.lindenlab.com",
+ "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
+ "http://aruna-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Durga",
+ "util.durga.lindenlab.com",
+ "https://login.durga.lindenlab.com/cgi-bin/login.cgi",
+ "http://durga-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Ganga",
+ "util.ganga.lindenlab.com",
+ "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",
+ "http://ganga-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Mitra",
+ "util.mitra.lindenlab.com",
+ "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
+ "http://mitra-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Mohini",
+ "util.mohini.lindenlab.com",
+ "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",
+ "http://mohini-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Nandi",
+ "util.nandi.lindenlab.com",
+ "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",
+ "http://nandi-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Radha",
+ "util.radha.lindenlab.com",
+ "https://login.radha.lindenlab.com/cgi-bin/login.cgi",
+ "http://radha-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Ravi",
+ "util.ravi.lindenlab.com",
+ "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",
+ "http://ravi-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Siva",
+ "util.siva.lindenlab.com",
+ "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
+ "http://siva-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Shakti",
+ "util.shakti.lindenlab.com",
+ "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
+ "http://shakti-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Soma",
+ "util.soma.lindenlab.com",
+ "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
+ "http://soma-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+
+ addSystemGrid("Uma",
+ "util.uma.lindenlab.com",
+ "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
+ "http://uma-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Vaak",
+ "util.vaak.lindenlab.com",
+ "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
+ "http://vaak-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Yami",
+ "util.yami.lindenlab.com",
+ "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
+ "http://yami-secondlife.webdev.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE);
+ addSystemGrid("Local (Linden)",
+ "localhost",
+ "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
+ "",
+ DEFAULT_LOGIN_PAGE);
+
+
+ LLSD other_grids;
+ llifstream llsd_xml;
+ if (!grid_file.empty())
{
- llerrs << "Invalid grid index specified." << llendl;
- return;
+ llsd_xml.open( grid_file.c_str(), std::ios::in | std::ios::binary );
+
+ // parse through the gridfile, inserting grids into the list unless
+ // they overwrite a linden grid.
+ if( llsd_xml.is_open())
+ {
+ LLSDSerialize::fromXMLDocument( other_grids, llsd_xml );
+ if(other_grids.isMap())
+ {
+ for(LLSD::map_iterator grid_itr = other_grids.beginMap();
+ grid_itr != other_grids.endMap();
+ ++grid_itr)
+ {
+ LLSD::String key_name = grid_itr->first;
+ LLSD grid = grid_itr->second;
+ // TODO: Make sure gridfile specified label is not
+ // a system grid label
+ LL_INFOS("GridManager") << "reading: " << key_name << LL_ENDL;
+ if (mGridList.has(key_name) &&
+ mGridList[key_name].has(GRID_IS_SYSTEM_GRID_VALUE))
+ {
+ LL_INFOS("GridManager") << "Cannot override grid " << key_name << " as it's a system grid" << LL_ENDL;
+ // If the system grid does exist in the grids file, and it's marked as a favorite, set it as a favorite.
+ if(grid_itr->second.has(GRID_IS_FAVORITE_VALUE) && grid_itr->second[GRID_IS_FAVORITE_VALUE].asBoolean() )
+ {
+ mGridList[key_name][GRID_IS_FAVORITE_VALUE] = TRUE;
+ }
+ }
+ else
+ {
+ try
+ {
+ addGrid(grid);
+ LL_INFOS("GridManager") << "Added grid: " << key_name << LL_ENDL;
+ }
+ catch (...)
+ {
+ }
+ }
+ }
+ llsd_xml.close();
+ }
+ }
}
+
+ // load a grid from the command line.
+ // if the actual grid name is specified from the command line,
+ // set it as the 'selected' grid.
+ mGrid = gSavedSettings.getString("CmdLineGridChoice");
+ LL_INFOS("GridManager") << "Grid Name: " << mGrid << LL_ENDL;
+
+ // If a command line login URI was passed in, so we should add the command
+ // line grid to the list of grids
- if(mGridChoice != grid || gSavedSettings.getS32("ServerChoice") != grid)
+ LLSD cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI");
+ if (cmd_line_login_uri.isString())
{
- mGridChoice = grid;
- if(GRID_INFO_LOCAL == mGridChoice)
+ LL_INFOS("GridManager") << "adding cmd line login uri" << LL_ENDL;
+ // grab the other related URI values
+ std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI");
+ std::string cmd_line_login_page = gSavedSettings.getString("LoginPage");
+
+ // we've a cmd line login, so add a grid for the command line,
+ // overwriting any existing grids
+ LLSD grid = LLSD::emptyMap();
+ grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+ grid[GRID_LOGIN_URI_VALUE].append(cmd_line_login_uri);
+ LL_INFOS("GridManager") << "cmd line login uri: " << cmd_line_login_uri.asString() << LL_ENDL;
+ LLURI uri(cmd_line_login_uri.asString());
+ if (mGrid.empty())
{
- mGridName = LOOPBACK_ADDRESS_STRING;
+ // if a grid name was not passed in via the command line,
+ // then set the grid name based on the hostname of the
+ // login uri
+ mGrid = uri.hostName();
}
- else if(GRID_INFO_OTHER == mGridChoice)
+
+ grid[GRID_VALUE] = mGrid;
+
+ if (mGridList.has(mGrid) && mGridList[mGrid].has(GRID_LABEL_VALUE))
{
- // *FIX:Mani - could this possibly be valid?
- mGridName = "other";
+ grid[GRID_LABEL_VALUE] = mGridList[mGrid][GRID_LABEL_VALUE];
}
else
{
- mGridName = gGridInfo[mGridChoice].mLabel;
+ grid[GRID_LABEL_VALUE] = mGrid;
+ }
+ if(!cmd_line_helper_uri.empty())
+ {
+ grid[GRID_HELPER_URI_VALUE] = cmd_line_helper_uri;
}
- gSavedSettings.setS32("ServerChoice", mGridChoice);
- gSavedSettings.setString("CustomServer", "");
+ if(!cmd_line_login_page.empty())
+ {
+ grid[GRID_LOGIN_PAGE_VALUE] = cmd_line_login_page;
+ }
+ // if the login page, helper URI value, and so on are not specified,
+ // add grid will generate them.
+
+ // Also, we will override a system grid if values are passed in via the command
+ // line, for testing. These values will not be remembered though.
+ if (mGridList.has(mGrid) && mGridList[mGrid].has(GRID_IS_SYSTEM_GRID_VALUE))
+ {
+ grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
+ }
+ addGrid(grid);
}
-}
+
+ // if a grid was not passed in via the command line, grab it from the CurrentGrid setting.
+ if (mGrid.empty())
+ {
+
+ mGrid = gSavedSettings.getString("CurrentGrid");
+ }
+
+ if (mGrid.empty() || !mGridList.has(mGrid))
+ {
+ // the grid name was empty, or the grid isn't actually in the list, then set it to the
+ // appropriate default.
+ LL_INFOS("GridManager") << "Resetting grid as grid name " << mGrid << " is not in the list" << LL_ENDL;
+ mGrid = MAINGRID;
+ }
+ LL_INFOS("GridManager") << "Selected grid is " << mGrid << LL_ENDL;
+ gSavedSettings.setString("CurrentGrid", mGrid);
-void LLViewerLogin::setGridChoice(const std::string& grid_name)
-{
- // Set the grid choice based on a string.
- // The string can be:
- // - a grid label from the gGridInfo table
- // - an ip address
- if(!grid_name.empty())
- {
- // find the grid choice from the user setting.
- int grid_index = GRID_INFO_NONE;
- for(;grid_index < GRID_INFO_OTHER; ++grid_index)
- {
- if(0 == LLStringUtil::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name))
- {
- // Founding a matching label in the list...
- setGridChoice((EGridInfo)grid_index);
- break;
- }
- }
-
- if(GRID_INFO_OTHER == grid_index)
- {
- // *FIX:MEP Can and should we validate that this is an IP address?
- mGridChoice = GRID_INFO_OTHER;
- mGridName = grid_name;
- gSavedSettings.setS32("ServerChoice", mGridChoice);
- gSavedSettings.setString("CustomServer", mGridName);
- }
- }
}
-void LLViewerLogin::resetURIs()
+LLGridManager::~LLGridManager()
{
- // Clear URIs when picking a new server
- gSavedSettings.setLLSD("CmdLineLoginURI", LLSD::emptyArray());
- gSavedSettings.setString("CmdLineHelperURI", "");
+ saveFavorites();
}
-EGridInfo LLViewerLogin::getGridChoice() const
+//
+// LLGridManager::addGrid - add a grid to the grid list, populating the needed values
+// if they're not populated yet.
+//
+
+void LLGridManager::addGrid(LLSD& grid_data)
{
- return mGridChoice;
+ if (grid_data.isMap() && grid_data.has(GRID_VALUE))
+ {
+ std::string grid = utf8str_tolower(grid_data[GRID_VALUE]);
+
+ // grid should be in the form of a dns address
+ if (!grid.empty() &&
+ grid.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890-_. ") != std::string::npos)
+ {
+ printf("grid name: %s", grid.c_str());
+ throw LLInvalidGridName(grid);
+ }
+
+ // populate the other values if they don't exist
+ if (!grid_data.has(GRID_LABEL_VALUE))
+ {
+ grid_data[GRID_LABEL_VALUE] = grid;
+ }
+ if (!grid_data.has(GRID_ID_VALUE))
+ {
+ grid_data[GRID_ID_VALUE] = grid;
+ }
+
+ // if the grid data doesn't include any of the URIs, then
+ // generate them from the grid, which should be a dns address
+ if (!grid_data.has(GRID_LOGIN_URI_VALUE))
+ {
+ grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+ grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") +
+ grid + "/cgi-bin/login.cgi");
+ }
+ // Populate to the default values
+ if (!grid_data.has(GRID_LOGIN_PAGE_VALUE))
+ {
+ grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
+ }
+ if (!grid_data.has(GRID_HELPER_URI_VALUE))
+ {
+ grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
+ }
+
+ if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
+ {
+ // non system grids and grids that haven't already been configured with values
+ // get both types of credentials.
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
+ }
+
+ LL_INFOS("GridManager") << "ADDING: " << grid << LL_ENDL;
+ mGridList[grid] = grid_data;
+ }
}
-std::string LLViewerLogin::getGridLabel() const
+//
+// LLGridManager::addSystemGrid - helper for adding a system grid.
+void LLGridManager::addSystemGrid(const std::string& label,
+ const std::string& name,
+ const std::string& login,
+ const std::string& helper,
+ const std::string& login_page,
+ const std::string& login_id)
{
- if(mGridChoice == GRID_INFO_NONE)
+ LLSD grid = LLSD::emptyMap();
+ grid[GRID_VALUE] = name;
+ grid[GRID_LABEL_VALUE] = label;
+ grid[GRID_HELPER_URI_VALUE] = helper;
+ grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+ grid[GRID_LOGIN_URI_VALUE].append(login);
+ grid[GRID_LOGIN_PAGE_VALUE] = login_page;
+ grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
+ grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
+ grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
+
+ grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
+ if (login_id.empty())
{
- return "None";
+ grid[GRID_ID_VALUE] = name;
}
- else if(mGridChoice < GRID_INFO_OTHER)
+ else
{
- return gGridInfo[mGridChoice].mLabel;
+ grid[GRID_ID_VALUE] = login_id;
}
-
- return mGridName;
-}
-
-std::string LLViewerLogin::getKnownGridLabel(EGridInfo grid_index) const
-{
- if(grid_index > GRID_INFO_NONE && grid_index < GRID_INFO_OTHER)
+
+ // only add the system grids beyond agni to the visible list
+ // if we're building a debug version.
+ if (name == std::string(MAINGRID))
{
- return gGridInfo[grid_index].mLabel;
+ grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;
+ grid[GRID_IS_FAVORITE_VALUE] = TRUE;
}
- return gGridInfo[GRID_INFO_NONE].mLabel;
+ else
+ {
+ grid[GRID_SLURL_BASE] = llformat(SYSTEM_GRID_SLURL_BASE, label.c_str());
+ }
+ addGrid(grid);
}
-void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const
+// return a list of grid name -> grid label mappings for UI purposes
+std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
{
- // return the login uri set on the command line.
- LLControlVariable* c = gSavedSettings.getControl("CmdLineLoginURI");
- if(c)
+ std::map<std::string, std::string> result;
+ for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+ grid_iter != mGridList.endMap();
+ grid_iter++)
{
- LLSD v = c->getValue();
- if(v.isArray())
- {
- for(LLSD::array_const_iterator itr = v.beginArray();
- itr != v.endArray(); ++itr)
- {
- std::string uri = itr->asString();
- if(!uri.empty())
- {
- uris.push_back(uri);
- }
- }
- }
- else
+ if(!favorite_only || grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
{
- std::string uri = v.asString();
- if(!uri.empty())
- {
- uris.push_back(uri);
- }
+ result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
}
}
- // If there was no command line uri...
- if(uris.empty())
+ return result;
+}
+
+void LLGridManager::setGridChoice(const std::string& grid)
+{
+ // Set the grid choice based on a string.
+ // The string can be:
+ // - a grid label from the gGridInfo table
+ // - a hostname
+ // - an ip address
+
+ // loop through. We could do just a hash lookup but we also want to match
+ // on label
+ for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+ grid_iter != mGridList.endMap();
+ grid_iter++)
{
- // If its a known grid choice, get the uri from the table,
- // else try the grid name.
- if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
+ if((grid == grid_iter->first) ||
+ (grid == grid_iter->second[GRID_LABEL_VALUE].asString()))
{
- uris.push_back(gGridInfo[mGridChoice].mLoginURI);
- }
- else
- {
- uris.push_back(mGridName);
+ mGrid = grid_iter->second[GRID_VALUE].asString();
+ gSavedSettings.setString("CurrentGrid", grid_iter->second[GRID_VALUE]);
+ return;
+
}
}
+ LLSD grid_data = LLSD::emptyMap();
+ grid_data[GRID_VALUE] = grid;
+ addGrid(grid_data);
+ mGrid = grid;
+ gSavedSettings.setString("CurrentGrid", grid);
}
-std::string LLViewerLogin::getHelperURI() const
+std::string LLGridManager::getGridByLabel( const std::string &grid_label)
{
- std::string helper_uri = gSavedSettings.getString("CmdLineHelperURI");
- if (helper_uri.empty())
+ for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+ grid_iter != mGridList.endMap();
+ grid_iter++)
{
- // grab URI from selected grid
- if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
+ if (grid_iter->second.has(GRID_LABEL_VALUE) && (grid_iter->second[GRID_LABEL_VALUE].asString() == grid_label))
{
- helper_uri = gGridInfo[mGridChoice].mHelperURI;
+ return grid_iter->first;
}
+ }
+ return std::string();
+}
- if (helper_uri.empty())
- {
- // what do we do with unnamed/miscellaneous grids?
- // for now, operations that rely on the helper URI (currency/land purchasing) will fail
- }
+void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
+{
+ uris.clear();
+ for (LLSD::array_iterator llsd_uri = mGridList[mGrid][GRID_LOGIN_URI_VALUE].beginArray();
+ llsd_uri != mGridList[mGrid][GRID_LOGIN_URI_VALUE].endArray();
+ llsd_uri++)
+ {
+ uris.push_back(llsd_uri->asString());
}
- return helper_uri;
}
-bool LLViewerLogin::isInProductionGrid()
+bool LLGridManager::isInProductionGrid()
{
// *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice,
// but it seems that loginURI trumps that.
std::vector<std::string> uris;
getLoginURIs(uris);
+ if (uris.size() < 1)
+ {
+ return 1;
+ }
LLStringUtil::toLower(uris[0]);
if((uris[0].find("agni") != std::string::npos))
{
@@ -339,3 +512,51 @@ bool LLViewerLogin::isInProductionGrid()
return false;
}
+
+void LLGridManager::saveFavorites()
+{
+ // filter out just those marked as favorites
+ LLSD output_grid_list = LLSD::emptyMap();
+ for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+ grid_iter != mGridList.endMap();
+ grid_iter++)
+ {
+ if(grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
+ {
+ output_grid_list[grid_iter->first] = grid_iter->second;
+ }
+ }
+ llofstream llsd_xml;
+ llsd_xml.open( mGridFile.c_str(), std::ios::out | std::ios::binary);
+ LLSDSerialize::toPrettyXML(output_grid_list, llsd_xml);
+ llsd_xml.close();
+}
+
+
+// build a slurl for the given region within the selected grid
+std::string LLGridManager::getSLURLBase(const std::string& grid)
+{
+ std::string grid_base;
+ if(mGridList.has(grid) && mGridList[grid].has(GRID_SLURL_BASE))
+ {
+ return mGridList[grid][GRID_SLURL_BASE].asString();
+ }
+ else
+ {
+ return llformat(DEFAULT_SLURL_BASE, grid.c_str());
+ }
+}
+
+// build a slurl for the given region within the selected grid
+std::string LLGridManager::getAppSLURLBase(const std::string& grid)
+{
+ std::string grid_base;
+ if(mGridList.has(grid) && mGridList[grid].has(GRID_APP_SLURL_BASE))
+ {
+ return mGridList[grid][GRID_APP_SLURL_BASE].asString();
+ }
+ else
+ {
+ return llformat(DEFAULT_APP_SLURL_BASE, grid.c_str());
+ }
+}
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index edae6dc47b..0271e7a7a5 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -5,7 +5,7 @@
*
* $LicenseInfo:firstyear=2006&license=viewergpl$
*
- * Copyright (c) 2006-2009, Linden Research, Inc.
+ * Copyright (c) 2006-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,13 +13,12 @@
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -33,83 +32,134 @@
#ifndef LL_LLVIEWERNETWORK_H
#define LL_LLVIEWERNETWORK_H
+
+extern const char* DEFAULT_LOGIN_PAGE;
+
+#define GRID_VALUE "name"
+#define GRID_LABEL_VALUE "label"
+#define GRID_ID_VALUE "grid_login_id"
+#define GRID_LOGIN_URI_VALUE "login_uri"
+#define GRID_HELPER_URI_VALUE "helper_uri"
+#define GRID_LOGIN_PAGE_VALUE "login_page"
+#define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
+#define GRID_IS_FAVORITE_VALUE "favorite"
+#define MAINGRID "util.agni.lindenlab.com"
+#define GRID_LOGIN_IDENTIFIER_TYPES "login_identifier_types"
+// defines slurl formats associated with various grids.
+// we need to continue to support existing forms, as slurls
+// are shared between viewers that may not understand newer
+// forms.
+#define GRID_SLURL_BASE "slurl_base"
+#define GRID_APP_SLURL_BASE "app_slurl_base"
-#include <boost/scoped_ptr.hpp>
-
-class LLHost;
-class LLLogin;
-
-enum EGridInfo
+class LLInvalidGridName
{
- GRID_INFO_NONE,
- GRID_INFO_ADITI,
- GRID_INFO_AGNI,
- GRID_INFO_ARUNA,
- GRID_INFO_BHARATI,
- GRID_INFO_CHANDRA,
- GRID_INFO_DAMBALLAH,
- GRID_INFO_DANU,
- GRID_INFO_DURGA,
- GRID_INFO_GANGA,
- GRID_INFO_MITRA,
- GRID_INFO_MOHINI,
- GRID_INFO_NANDI,
- GRID_INFO_PARVATI,
- GRID_INFO_RADHA,
- GRID_INFO_RAVI,
- GRID_INFO_SIVA,
- GRID_INFO_SHAKTI,
- GRID_INFO_SKANDA,
- GRID_INFO_SOMA,
- GRID_INFO_UMA,
- GRID_INFO_VAAK,
- GRID_INFO_YAMI,
- GRID_INFO_LOCAL,
- GRID_INFO_OTHER, // IP address set via command line option
- GRID_INFO_COUNT
+public:
+ LLInvalidGridName(std::string grid) : mGrid(grid)
+ {
+ }
+protected:
+ std::string mGrid;
};
+
/**
- * @brief A class to manage the viewer's login state.
+ * @brief A class to manage the grids available to the viewer
+ * including persistance. This class also maintains the currently
+ * selected grid.
*
**/
-class LLViewerLogin : public LLSingleton<LLViewerLogin>
+class LLGridManager : public LLSingleton<LLGridManager>
{
public:
- LLViewerLogin();
- ~LLViewerLogin();
-
- void setGridChoice(EGridInfo grid);
- void setGridChoice(const std::string& grid_name);
- void resetURIs();
+
+ // when the grid manager is instantiated, the default grids are automatically
+ // loaded, and the grids favorites list is loaded from the xml file.
+ LLGridManager(const std::string& grid_file);
+ LLGridManager();
+ ~LLGridManager();
+
+ void initialize(const std::string& grid_file);
+ // grid list management
+
+ // add a grid to the list of grids
+ void addGrid(LLSD& grid_info);
- /**
- * @brief Get the enumeration of the grid choice.
- * Should only return values > 0 && < GRID_INFO_COUNT
- **/
- EGridInfo getGridChoice() const;
-
- /**
- * @brief Get a readable label for the grid choice.
- * Returns the readable name for the grid choice.
- * If the grid is 'other', returns something
- * the string used to specifiy the grid.
- **/
- std::string getGridLabel() const;
-
- std::string getKnownGridLabel(EGridInfo grid_index) const;
-
- void getLoginURIs(std::vector<std::string>& uris) const;
- std::string getHelperURI() const;
+ // retrieve a map of grid-name <-> label
+ // by default only return the user visible grids
+ std::map<std::string, std::string> getKnownGrids(bool favorites_only=FALSE);
+
+ LLSD getGridInfo(const std::string& grid)
+ {
+ if(mGridList.has(grid))
+ {
+ return mGridList[grid];
+ }
+ else
+ {
+ return LLSD();
+ }
+ }
+
+ // current grid management
+ // select a given grid as the current grid. If the grid
+ // is not a known grid, then it's assumed to be a dns name for the
+ // grid, and the various URIs will be automatically generated.
+ void setGridChoice(const std::string& grid);
+
+
+ std::string getGridLabel() { return mGridList[mGrid][GRID_LABEL_VALUE]; }
+ std::string getGrid() const { return mGrid; }
+ void getLoginURIs(std::vector<std::string>& uris);
+ std::string getHelperURI() {return mGridList[mGrid][GRID_HELPER_URI_VALUE];}
+ std::string getLoginPage() {return mGridList[mGrid][GRID_LOGIN_PAGE_VALUE];}
+ std::string getGridLoginID() { return mGridList[mGrid][GRID_ID_VALUE]; }
+ std::string getLoginPage(const std::string& grid) { return mGridList[grid][GRID_LOGIN_PAGE_VALUE]; }
+ void getLoginIdentifierTypes(LLSD& idTypes) { idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES]; }
+
+ // build a slurl for the given region within the selected grid
+ std::string getSLURLBase(const std::string& grid);
+ std::string getSLURLBase() { return getSLURLBase(mGrid); }
+
+ std::string getAppSLURLBase(const std::string& grid);
+ std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); }
+
+ LLSD getGridInfo() { return mGridList[mGrid]; }
+
+ std::string getGridByLabel( const std::string &grid_label);
+
+ bool isSystemGrid(const std::string& grid)
+ {
+ return mGridList.has(grid) &&
+ mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE) &&
+ mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean();
+ }
+ bool isSystemGrid() { return isSystemGrid(mGrid); }
+ // Mark this grid as a favorite that should be persisited on 'save'
+ // this is currently used to persist a grid after a successful login
+ void setFavorite() { mGridList[mGrid][GRID_IS_FAVORITE_VALUE] = TRUE; }
+
bool isInProductionGrid();
+ void saveFavorites();
+ void clearFavorites();
+
+protected:
-private:
- EGridInfo mGridChoice;
- std::string mGridName;
+ // helper function for adding the predefined grids
+ void addSystemGrid(const std::string& label,
+ const std::string& name,
+ const std::string& login,
+ const std::string& helper,
+ const std::string& login_page,
+ const std::string& login_id = "");
+
+
+ std::string mGrid;
+ std::string mGridFile;
+ LLSD mGridList;
};
const S32 MAC_ADDRESS_BYTES = 6;
-extern unsigned char gMACAddress[MAC_ADDRESS_BYTES]; /* Flawfinder: ignore */
#endif
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index bb7933c10e..ee89680fea 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4727,7 +4727,7 @@ BOOL LLViewerObject::permYouOwner() const
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
{
return TRUE;
@@ -4764,7 +4764,7 @@ BOOL LLViewerObject::permOwnerModify() const
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
{
return TRUE;
@@ -4788,7 +4788,7 @@ BOOL LLViewerObject::permModify() const
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
{
return TRUE;
@@ -4812,7 +4812,7 @@ BOOL LLViewerObject::permCopy() const
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
{
return TRUE;
@@ -4836,7 +4836,7 @@ BOOL LLViewerObject::permMove() const
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
{
return TRUE;
@@ -4860,7 +4860,7 @@ BOOL LLViewerObject::permTransfer() const
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLViewerLogin::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
{
return TRUE;
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index b7c265be59..bdc34d0f18 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -768,9 +768,11 @@ void send_stats()
system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB();
system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
system["cpu"] = gSysCPU.getCPUString();
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
std::string macAddressString = llformat("%02x-%02x-%02x-%02x-%02x-%02x",
- gMACAddress[0],gMACAddress[1],gMACAddress[2],
- gMACAddress[3],gMACAddress[4],gMACAddress[5]);
+ MACAddress[0],MACAddress[1],MACAddress[2],
+ MACAddress[3],MACAddress[4],MACAddress[5]);
system["mac_address"] = macAddressString;
system["serial_number"] = LLAppViewer::instance()->getSerialNumber();
std::string gpu_desc = llformat(
diff --git a/indra/newview/llviewervisualparam.cpp b/indra/newview/llviewervisualparam.cpp
index fad398e00b..422e530dc6 100644
--- a/indra/newview/llviewervisualparam.cpp
+++ b/indra/newview/llviewervisualparam.cpp
@@ -45,7 +45,7 @@
//-----------------------------------------------------------------------------
LLViewerVisualParamInfo::LLViewerVisualParamInfo()
:
- mWearableType( WT_INVALID ),
+ mWearableType( LLWearableType::WT_INVALID ),
mCrossWearable(FALSE),
mCamDist( 0.5f ),
mCamAngle( 0.f ),
@@ -77,7 +77,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node)
static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable");
if( node->getFastAttributeString( wearable_string, wearable) )
{
- mWearableType = LLWearableDictionary::typeNameToType( wearable );
+ mWearableType = LLWearableType::typeNameToType( wearable );
}
static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group");
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 7a3f88ed6f..56d22a0608 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -85,7 +85,6 @@
#include "lltooltip.h"
#include "llmediaentry.h"
#include "llurldispatcher.h"
-#include "llurlsimstring.h"
// newview includes
#include "llagent.h"
@@ -799,7 +798,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = TRUE;
- gVoiceClient->middleMouseState(true);
+ LLVoiceClient::getInstance()->middleMouseState(true);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
@@ -826,20 +825,16 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
if (slurl_dnd_enabled)
{
-
- // special case SLURLs
- // isValidSLURL() call was added here to make sure that dragged SLURL is valid (EXT-4964)
- if ( LLSLURL::isSLURL( data ) && LLSLURL::isValidSLURL( data ) )
+ LLSLURL dropped_slurl(data);
+ if(dropped_slurl.isSpatial())
{
if (drop)
{
- LLURLDispatcher::dispatch( data, NULL, true );
- LLURLSimString::setStringRaw( LLSLURL::stripProtocol( data ) );
- LLPanelLogin::refreshLocation( true );
- LLPanelLogin::updateLocationUI();
+ LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), NULL, true );
+ return LLWindowCallbacks::DND_MOVE;
}
return LLWindowCallbacks::DND_COPY;
- };
+ }
}
if (prim_media_dnd_enabled)
@@ -957,7 +952,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = FALSE;
- gVoiceClient->middleMouseState(false);
+ LLVoiceClient::getInstance()->middleMouseState(false);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
@@ -1074,7 +1069,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
{
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
- gVoiceClient->keyDown(key, mask);
+ LLVoiceClient::getInstance()->keyDown(key, mask);
if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
{
@@ -1096,7 +1091,7 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask)
{
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
- gVoiceClient->keyUp(key, mask);
+ LLVoiceClient::getInstance()->keyUp(key, mask);
return FALSE;
}
@@ -1955,7 +1950,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible )
// ...and set the menu color appropriately.
setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT,
- LLViewerLogin::getInstance()->isInProductionGrid());
+ LLGridManager::getInstance()->isInProductionGrid());
}
if ( gStatusBar )
@@ -1976,15 +1971,15 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
LLSD args;
LLColor4 new_bg_color;
- if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid())
+ if(god_mode && LLGridManager::getInstance()->isInProductionGrid())
{
new_bg_color = LLUIColorTable::instance().getColor( "MenuBarGodBgColor" );
}
- else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
+ else if(god_mode && !LLGridManager::getInstance()->isInProductionGrid())
{
new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" );
}
- else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
+ else if(!god_mode && !LLGridManager::getInstance()->isInProductionGrid())
{
new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
}
@@ -2200,7 +2195,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
return TRUE;
}
-
// hidden edit menu for cut/copy/paste
if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 69d2ef7dd7..2ec8ced543 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -102,8 +102,6 @@
#include <boost/lexical_cast.hpp>
-#define DISPLAY_AVATAR_LOAD_TIMES
-
using namespace LLVOAvatarDefines;
//-----------------------------------------------------------------------------
@@ -828,7 +826,7 @@ BOOL LLVOAvatar::isFullyBaked()
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex)
- && ( (i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ) )
+ && ( (i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ) )
{
return FALSE;
}
@@ -1270,7 +1268,7 @@ void LLVOAvatar::initInstance(void)
//VTPause(); // VTune
- mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) );
+ mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
}
const LLVector3 LLVOAvatar::getRenderPosition() const
@@ -2201,8 +2199,8 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
}
static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false);
- bool voice_enabled = (visualizers_in_calls || gVoiceClient->inProximalChannel()) &&
- gVoiceClient->getVoiceEnabled(mID);
+ bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) &&
+ LLVoiceClient::getInstance()->getVoiceEnabled(mID);
idleUpdateVoiceVisualizer( voice_enabled );
idleUpdateMisc( detailed_update );
@@ -2265,7 +2263,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
// Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
// "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking.
//-----------------------------------------------------------------------------------------------------------------
- if (gVoiceClient->getIsSpeaking( mID ))
+ if (LLVoiceClient::getInstance()->getIsSpeaking( mID ))
{
if (!mVoiceVisualizer->getCurrentlySpeaking())
{
@@ -2274,7 +2272,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
//printf( "gAwayTimer.reset();\n" );
}
- mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) );
+ mVoiceVisualizer->setSpeakingAmplitude( LLVoiceClient::getInstance()->getCurrentPower( mID ) );
if( isSelf() )
{
@@ -2503,7 +2501,7 @@ F32 LLVOAvatar::calcMorphAmount()
void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
{
// Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
- if ( voice_enabled && (gVoiceClient->lipSyncEnabled()) && gVoiceClient->getIsSpeaking( mID ) )
+ if ( voice_enabled && (LLVoiceClient::getInstance()->lipSyncEnabled()) && LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
{
F32 ooh_morph_amount = 0.0f;
F32 aah_morph_amount = 0.0f;
@@ -3670,7 +3668,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry();
mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry();
- if( isWearingWearableType( WT_SKIRT ) )
+ if( isWearingWearableType( LLWearableType::WT_SKIRT ) )
{
mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry();
}
@@ -3830,7 +3828,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
U32 LLVOAvatar::renderTransparent(BOOL first_pass)
{
U32 num_indices = 0;
- if( isWearingWearableType( WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) )
+ if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) )
{
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f);
num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE);
@@ -4033,7 +4031,7 @@ void LLVOAvatar::updateTextures()
mHasGrey = FALSE; // debug
for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
{
- EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index);
+ LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index);
U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
const LLTextureEntry *te = getTE(texture_index);
const F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
@@ -4096,6 +4094,7 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel
mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
mMinPixelArea = llmin(pixel_area, mMinPixelArea);
imagep->resetTextureStats();
+ imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures.
imagep->addTextureStats(pixel_area / texel_area_ratio);
imagep->setBoostLevel(boost_level);
}
@@ -5474,6 +5473,14 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi
{
S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState());
+ // This should never happen unless the server didn't process the attachment point
+ // correctly, but putting this check in here to be safe.
+ if (attachmentID & ATTACHMENT_ADD)
+ {
+ llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl;
+ attachmentID &= ~ATTACHMENT_ADD;
+ }
+
LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
if (!attachment)
@@ -5885,16 +5892,17 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > PAUSE);
-#ifdef DISPLAY_AVATAR_LOAD_TIMES
- if (!mPreviousFullyLoaded && !loading && mFullyLoaded)
+ if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
{
- llinfos << "Avatar '" << getFullname() << "' resolved in " << mRuthDebugTimer.getElapsedTimeF32() << " seconds." << llendl;
- LLSD args;
- args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32());
- args["NAME"] = getFullname();
- LLNotificationsUtil::add("AvatarRezNotification",args);
+ if (!mPreviousFullyLoaded && !loading && mFullyLoaded)
+ {
+ llinfos << "Avatar '" << getFullname() << "' resolved in " << mRuthDebugTimer.getElapsedTimeF32() << " seconds." << llendl;
+ LLSD args;
+ args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32());
+ args["NAME"] = getFullname();
+ LLNotificationsUtil::add("AvatarRezNotification",args);
+ }
}
-#endif
// did our loading state "change" from last call?
const S32 UPDATE_RATE = 30;
@@ -6199,7 +6207,7 @@ void LLVOAvatar::releaseComponentTextures()
const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
// skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
if (!isTextureDefined(bakedDicEntry->mTextureIndex)
- && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ))
+ && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ))
{
continue;
}
@@ -6347,23 +6355,23 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
}
// Unlike most wearable functions, this works for both self and other.
-BOOL LLVOAvatar::isWearingWearableType(EWearableType type) const
+BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
{
if (mIsDummy) return TRUE;
switch(type)
{
- case WT_SHAPE:
- case WT_SKIN:
- case WT_HAIR:
- case WT_EYES:
+ case LLWearableType::WT_SHAPE:
+ case LLWearableType::WT_SKIN:
+ case LLWearableType::WT_HAIR:
+ case LLWearableType::WT_EYES:
return TRUE; // everyone has all bodyparts
default:
break; // Do nothing
}
/* switch(type)
- case WT_SHIRT:
+ case LLWearableType::WT_SHIRT:
indicator_te = TEX_UPPER_SHIRT; */
for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
@@ -6880,9 +6888,9 @@ void LLVOAvatar::dumpArchetypeXML( void* )
apr_file_printf( file, "\n\t<archetype name=\"???\">\n" );
// only body parts, not clothing.
- for (S32 type = WT_SHAPE; type <= WT_EYES; type++)
+ for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_EYES; type++)
{
- const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type);
+ const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type);
apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
for (LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam())
@@ -7688,7 +7696,7 @@ void LLVOAvatar::idleUpdateRenderCost()
{
const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
ETextureIndex tex_index = baked_dict->mTextureIndex;
- if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(WT_SKIRT)))
+ if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT)))
{
if (isTextureVisible(tex_index))
{
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index c80d59966c..24bd2739f7 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -71,9 +71,10 @@ class LLTexGlobalColor;
class LLVOAvatarBoneInfo;
class LLVOAvatarSkeletonInfo;
-//------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLVOAvatar
-//------------------------------------------------------------------------
+//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLVOAvatar :
public LLViewerObject,
public LLCharacter
@@ -138,13 +139,13 @@ public:
virtual void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax);
virtual void getSpatialExtents(LLVector3& newMin, LLVector3& newMax);
virtual BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- S32* face_hit = NULL, // which face was hit
- LLVector3* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector3* normal = NULL, // return the surface normal at the intersection point
- LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ S32* face_hit = NULL, // which face was hit
+ LLVector3* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector3* normal = NULL, // return the surface normal at the intersection point
+ LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point
//--------------------------------------------------------------------
// LLCharacter interface and related
@@ -646,7 +647,7 @@ public:
**/
public:
- virtual BOOL isWearingWearableType(EWearableType type ) const;
+ virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
//--------------------------------------------------------------------
// Attachments
diff --git a/indra/newview/llvoavatardefines.cpp b/indra/newview/llvoavatardefines.cpp
index 49c4a1a6c8..ed0a4f147d 100644
--- a/indra/newview/llvoavatardefines.cpp
+++ b/indra/newview/llvoavatardefines.cpp
@@ -46,31 +46,31 @@ using namespace LLVOAvatarDefines;
LLVOAvatarDictionary::Textures::Textures()
{
- addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN));
- addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", WT_SHIRT));
- addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", WT_PANTS));
- addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", WT_EYES));
- addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", WT_HAIR));
- addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN));
- addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN));
- addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", WT_SHOES));
- addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", WT_SOCKS));
- addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET));
- addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET));
- addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", WT_GLOVES));
- addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERSHIRT));
- addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERPANTS));
- addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", WT_SKIRT));
+ addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
+ addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
+ addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS));
+ addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES));
+ addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR));
+ addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
+ addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
+ addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES));
+ addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS));
+ addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
+ addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
+ addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES));
+ addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT));
+ addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS));
+ addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT));
- addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA));
- addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA));
- addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA));
- addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA));
- addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA));
+ addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
- addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO));
- addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO));
- addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO));
+ addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
+ addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
+ addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD));
addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER));
@@ -86,34 +86,34 @@ LLVOAvatarDictionary::BakedTextures::BakedTextures()
addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
"head", "a4b9dc38-e13b-4df9-b284-751efb0566ff",
3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA,
- 5, WT_SHAPE, WT_SKIN, WT_HAIR, WT_TATTOO, WT_ALPHA));
+ 5, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED,
"upper_body", "5943ff64-d26c-4a90-a8c0-d61f56bd98d4",
7, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET,
TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA,
- 8, WT_SHAPE, WT_SKIN, WT_SHIRT, WT_JACKET, WT_GLOVES, WT_UNDERSHIRT, WT_TATTOO, WT_ALPHA));
+ 8, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED,
"lower_body", "2944ee70-90a7-425d-a5fb-d749c782ed7d",
8, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS,
TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA,
- 9, WT_SHAPE, WT_SKIN, WT_PANTS, WT_SHOES, WT_SOCKS, WT_JACKET, WT_UNDERPANTS, WT_TATTOO, WT_ALPHA));
+ 9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED,
"eyes", "27b1bc0f-979f-4b13-95fe-b981c2ba9788",
2, TEX_EYES_IRIS, TEX_EYES_ALPHA,
- 2, WT_EYES, WT_ALPHA));
+ 2, LLWearableType::WT_EYES, LLWearableType::WT_ALPHA));
addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED,
"skirt", "03e7e8cb-1368-483b-b6f3-74850838ba63",
1, TEX_SKIRT,
- 1, WT_SKIRT));
+ 1, LLWearableType::WT_SKIRT));
addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED,
"hair", "a60e85a9-74e8-48d8-8a2d-8129f28d9b61",
2, TEX_HAIR, TEX_HAIR_ALPHA,
- 2, WT_HAIR, WT_ALPHA));
+ 2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
}
LLVOAvatarDictionary::Meshes::Meshes()
@@ -170,7 +170,7 @@ LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
bool is_local_texture,
EBakedTextureIndex baked_texture_index,
const std::string &default_image_name,
- EWearableType wearable_type) :
+ LLWearableType::EType wearable_type) :
LLDictionaryEntry(name),
mIsLocalTexture(is_local_texture),
mIsBakedTexture(!is_local_texture),
@@ -216,7 +216,7 @@ LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
// Read in wearables
for (U8 i=0; i < num_wearables; i++)
{
- EWearableType t = (EWearableType)va_arg(argp,int);
+ LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int);
mWearables.push_back(t);
}
}
@@ -261,7 +261,7 @@ const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index)
}
// static
-EWearableType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index )
+LLWearableType::EType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index )
{
return getInstance()->getTexture(index)->mWearableType;
}
diff --git a/indra/newview/llvoavatardefines.h b/indra/newview/llvoavatardefines.h
index cf3d318159..9c4ee7e716 100644
--- a/indra/newview/llvoavatardefines.h
+++ b/indra/newview/llvoavatardefines.h
@@ -114,7 +114,7 @@ enum EMeshIndex
typedef std::vector<ETextureIndex> texture_vec_t;
typedef std::vector<EBakedTextureIndex> bakedtexture_vec_t;
typedef std::vector<EMeshIndex> mesh_vec_t;
-typedef std::vector<EWearableType> wearables_vec_t;
+typedef std::vector<LLWearableType::EType> wearables_vec_t;
//------------------------------------------------------------------------
// LLVOAvatarDictionary
@@ -145,9 +145,9 @@ public:
bool is_local_texture,
EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
const std::string& default_image_name = "",
- EWearableType wearable_type = WT_INVALID);
+ LLWearableType::EType wearable_type = LLWearableType::WT_INVALID);
const std::string mDefaultImageName;
- const EWearableType mWearableType;
+ const LLWearableType::EType mWearableType;
// It's either a local texture xor baked
BOOL mIsLocalTexture;
BOOL mIsBakedTexture;
@@ -225,7 +225,7 @@ public:
static const LLUUID getDefaultTextureImageID(ETextureIndex index);
// Given a texture entry, determine which wearable type owns it.
- static EWearableType getTEWearableType(ETextureIndex index);
+ static LLWearableType::EType getTEWearableType(ETextureIndex index);
}; // End LLVOAvatarDictionary
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 63f060b58a..dec2e7efdf 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -183,7 +183,7 @@ void LLVOAvatarSelf::markDead()
param;
param = (LLViewerVisualParam*) getNextVisualParam())
{
- if (param->getWearableType() != WT_INVALID)
+ if (param->getWearableType() != LLWearableType::WT_INVALID)
{
param->setIsDummy(TRUE);
}
@@ -679,7 +679,7 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL
if (param->getCrossWearable())
{
- EWearableType type = (EWearableType)param->getWearableType();
+ LLWearableType::EType type = (LLWearableType::EType)param->getWearableType();
U32 size = gAgentWearables.getWearableCount(type);
for (U32 count = 0; count < size; ++count)
{
@@ -707,9 +707,9 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation()
gAgentWearables.animateAllWearableParams(calcMorphAmount(), FALSE);
// apply wearable visual params to avatar
- for (U32 type = 0; type < WT_COUNT; type++)
+ for (U32 type = 0; type < LLWearableType::WT_COUNT; type++)
{
- LLWearable *wearable = gAgentWearables.getTopWearable((EWearableType)type);
+ LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
if (wearable)
{
wearable->writeToAvatar();
@@ -943,17 +943,17 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode)
}
}
-/*virtual*/ BOOL LLVOAvatarSelf::isWearingWearableType(EWearableType type ) const
+/*virtual*/ BOOL LLVOAvatarSelf::isWearingWearableType(LLWearableType::EType type ) const
{
return gAgentWearables.getWearableCount(type) > 0;
}
//-----------------------------------------------------------------------------
-// updatedWearable( EWearableType type )
+// updatedWearable( LLWearableType::EType type )
// forces an update to any baked textures relevant to type.
// will force an upload of the resulting bake if the second parameter is TRUE
//-----------------------------------------------------------------------------
-void LLVOAvatarSelf::wearableUpdated( EWearableType type, BOOL upload_result )
+void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_result )
{
for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
@@ -974,7 +974,7 @@ void LLVOAvatarSelf::wearableUpdated( EWearableType type, BOOL upload_result )
type_iter != baked_dict->mWearables.end();
++type_iter)
{
- const EWearableType comp_type = *type_iter;
+ const LLWearableType::EType comp_type = *type_iter;
if (comp_type == type)
{
if (mBakedTextureDatas[index].mTexLayerSet)
@@ -1110,7 +1110,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
U32 LLVOAvatarSelf::getNumWearables(LLVOAvatarDefines::ETextureIndex i) const
{
- EWearableType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
+ LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
return gAgentWearables.getWearableCount(type);
}
@@ -1238,7 +1238,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset)
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -1270,7 +1270,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) cons
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -1293,7 +1293,7 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32
BOOL isDefined = TRUE;
if (isIndexLocalTexture(type))
{
- const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType(type);
+ const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(type);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
if (index >= wearable_count)
{
@@ -1435,7 +1435,7 @@ void LLVOAvatarSelf::updateComposites()
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
if (mBakedTextureDatas[i].mTexLayerSet
- && ((i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT)))
+ && ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT)))
{
mBakedTextureDatas[i].mTexLayerSet->updateComposite();
}
@@ -1514,7 +1514,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
llerrs << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << llendl;
return;
}
- EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType(type);
+ LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType(type);
if (!gAgentWearables.getWearable(wearable_type,index))
{
// no wearable is loaded, cannot set the texture.
@@ -1700,10 +1700,10 @@ void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()
BOOL LLVOAvatarSelf::getIsCloud()
{
// do we have our body parts?
- if (gAgentWearables.getWearableCount(WT_SHAPE) == 0 ||
- gAgentWearables.getWearableCount(WT_HAIR) == 0 ||
- gAgentWearables.getWearableCount(WT_EYES) == 0 ||
- gAgentWearables.getWearableCount(WT_SKIN) == 0)
+ if (gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE) == 0 ||
+ gAgentWearables.getWearableCount(LLWearableType::WT_HAIR) == 0 ||
+ gAgentWearables.getWearableCount(LLWearableType::WT_EYES) == 0 ||
+ gAgentWearables.getWearableCount(LLWearableType::WT_SKIN) == 0)
{
return TRUE;
}
@@ -1729,7 +1729,7 @@ BOOL LLVOAvatarSelf::getIsCloud()
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- if (i == BAKED_SKIRT && !isWearingWearableType(WT_SKIRT))
+ if (i == BAKED_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT))
continue;
const BakedTextureData& texture_data = mBakedTextureDatas[i];
@@ -1852,7 +1852,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 wearable_index) const
{
- EWearableType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
+ LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
LLWearable* wearable = gAgentWearables.getWearable(type, wearable_index);
if (wearable)
{
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 337d445eac..460291a929 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -39,9 +39,10 @@
struct LocalTextureData;
-//------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLVOAvatarSelf
-//------------------------------------------------------------------------
+//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLVOAvatarSelf :
public LLVOAvatar
{
@@ -272,8 +273,8 @@ protected:
**/
public:
- /*virtual*/ BOOL isWearingWearableType(EWearableType type) const;
- void wearableUpdated(EWearableType type, BOOL upload_result);
+ /*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type) const;
+ void wearableUpdated(LLWearableType::EType type, BOOL upload_result);
protected:
U32 getNumWearables(LLVOAvatarDefines::ETextureIndex i) const;
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 7bb1006e93..25b46f8e55 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -72,9 +72,9 @@ private:
void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
{
- llwarns << "LLVoiceCallCapResponder::error("
+ LL_WARNS("Voice") << "LLVoiceCallCapResponder::error("
<< status << ": " << reason << ")"
- << llendl;
+ << LL_ENDL;
LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
if ( channelp )
{
@@ -104,8 +104,8 @@ void LLVoiceCallCapResponder::result(const LLSD& content)
LLSD::map_const_iterator iter;
for(iter = content.beginMap(); iter != content.endMap(); ++iter)
{
- llinfos << "LLVoiceCallCapResponder::result got "
- << iter->first << llendl;
+ LL_DEBUGS("Voice") << "LLVoiceCallCapResponder::result got "
+ << iter->first << LL_ENDL;
}
channelp->setChannelInfo(
@@ -131,10 +131,8 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
{
// a voice channel already exists for this session id, so this instance will be orphaned
// the end result should simply be the failure to make voice calls
- llwarns << "Duplicate voice channels registered for session_id " << session_id << llendl;
+ LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
}
-
- LLVoiceClient::getInstance()->addObserver(this);
}
LLVoiceChannel::~LLVoiceChannel()
@@ -142,7 +140,7 @@ LLVoiceChannel::~LLVoiceChannel()
// Must check instance exists here, the singleton MAY have already been destroyed.
if(LLVoiceClient::instanceExists())
{
- LLVoiceClient::instance().removeObserver(this);
+ LLVoiceClient::getInstance()->removeObserver(this);
}
sVoiceChannelMap.erase(mSessionID);
@@ -162,13 +160,13 @@ void LLVoiceChannel::setChannelInfo(
if (mURI.empty())
{
LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
- llwarns << "Received empty URI for channel " << mSessionName << llendl;
+ LL_WARNS("Voice") << "Received empty URI for channel " << mSessionName << LL_ENDL;
deactivate();
}
else if (mCredentials.empty())
{
LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
- llwarns << "Received empty credentials for channel " << mSessionName << llendl;
+ LL_WARNS("Voice") << "Received empty credentials for channel " << mSessionName << LL_ENDL;
deactivate();
}
else
@@ -283,13 +281,14 @@ void LLVoiceChannel::deactivate()
//Default mic is OFF when leaving voice calls
if (gSavedSettings.getBOOL("AutoDisengageMic") &&
sCurrentVoiceChannel == this &&
- gVoiceClient->getUserPTTState())
+ LLVoiceClient::getInstance()->getUserPTTState())
{
gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
- gVoiceClient->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
}
}
-
+ LLVoiceClient::getInstance()->removeObserver(this);
+
if (sCurrentVoiceChannel == this)
{
// default channel is proximal channel
@@ -329,7 +328,9 @@ void LLVoiceChannel::activate()
{
setState(STATE_CALL_STARTED);
}
-
+
+ LLVoiceClient::getInstance()->addObserver(this);
+
//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
sCurrentVoiceChannelChangedSignal(this->mSessionID);
}
@@ -371,6 +372,11 @@ LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri)
}
}
+LLVoiceChannel* LLVoiceChannel::getCurrentVoiceChannel()
+{
+ return sCurrentVoiceChannel;
+}
+
void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id)
{
sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID));
@@ -422,7 +428,6 @@ void LLVoiceChannel::initClass()
sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
}
-
//static
void LLVoiceChannel::suspend()
{
@@ -438,7 +443,7 @@ void LLVoiceChannel::resume()
{
if (sSuspended)
{
- if (gVoiceClient->voiceEnabled())
+ if (LLVoiceClient::getInstance()->voiceEnabled())
{
if (sSuspendedVoiceChannel)
{
@@ -508,9 +513,9 @@ void LLVoiceChannelGroup::activate()
#endif
//Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
- if (gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
+ if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
{
- gVoiceClient->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
}
}
@@ -557,7 +562,7 @@ void LLVoiceChannelGroup::setChannelInfo(
else
{
//*TODO: notify user
- llwarns << "Received invalid credentials for channel " << mSessionName << llendl;
+ LL_WARNS("Voice") << "Received invalid credentials for channel " << mSessionName << LL_ENDL;
deactivate();
}
}
@@ -656,7 +661,6 @@ void LLVoiceChannelGroup::setState(EState state)
LLVoiceChannelProximal::LLVoiceChannelProximal() :
LLVoiceChannel(LLUUID::null, LLStringUtil::null)
{
- activate();
}
BOOL LLVoiceChannelProximal::isActive()
@@ -668,13 +672,13 @@ void LLVoiceChannelProximal::activate()
{
if (callStarted()) return;
- LLVoiceChannel::activate();
-
- if (callStarted())
+ if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
{
- // this implicitly puts you back in the spatial channel
- LLVoiceClient::getInstance()->leaveNonSpatialChannel();
+ // we're connected to a non-spatial channel, so disconnect.
+ LLVoiceClient::getInstance()->leaveNonSpatialChannel();
}
+ LLVoiceChannel::activate();
+
}
void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
@@ -704,7 +708,7 @@ void LLVoiceChannelProximal::handleStatusChange(EStatusType status)
return;
case STATUS_VOICE_DISABLED:
//skip showing "Voice not available at your current location" when agent voice is disabled (EXT-4749)
- if(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking())
+ if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
{
//TODO: remove or redirect this call status notification
// LLCallInfoDialog::show("unavailable", mNotifyArgs);
@@ -764,7 +768,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string
void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
{
- llinfos << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << llendl;
+ LL_INFOS("Voice") << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << LL_ENDL;
// status updates
switch(type)
@@ -838,9 +842,9 @@ void LLVoiceChannelP2P::activate()
LLRecentPeople::instance().add(mOtherUserID);
//Default mic is ON on initiating/joining P2P calls
- if (!gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
+ if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
{
- gVoiceClient->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
}
}
}
@@ -903,7 +907,7 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s
void LLVoiceChannelP2P::setState(EState state)
{
- llinfos << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << llendl;
+ LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;
if (mReceivedCall) // incoming call
{
diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h
index 941cccacc3..573fab1f4f 100644
--- a/indra/newview/llvoicechannel.h
+++ b/indra/newview/llvoicechannel.h
@@ -98,7 +98,8 @@ public:
static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
static LLVoiceChannel* getChannelByURI(std::string uri);
- static LLVoiceChannel* getCurrentVoiceChannel() { return sCurrentVoiceChannel; }
+ static LLVoiceChannel* getCurrentVoiceChannel();
+
static void initClass();
static void suspend();
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 542ec16547..91353281a8 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1,6 +1,6 @@
/**
* @file llvoiceclient.cpp
- * @brief Implementation of LLVoiceClient class which is the interface to the voice client process.
+ * @brief Voice client delegation class implementation.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -17,8 +17,7 @@
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -32,5420 +31,311 @@
#include "llviewerprecompiledheaders.h"
#include "llvoiceclient.h"
-
-#include <boost/tokenizer.hpp>
-
-// library includes
-#include "llnotificationsutil.h"
-#include "llsdserialize.h"
-#include "llsdutil.h"
-
-
-// project includes
-#include "llvoavatar.h"
-#include "llbufferstream.h"
-#include "llfile.h"
-#ifdef LL_STANDALONE
-# include "expat.h"
-#else
-# include "expat/expat.h"
-#endif
-#include "llcallbacklist.h"
-#include "llcallingcard.h" // for LLFriendObserver
-#include "llviewerregion.h"
-#include "llviewernetwork.h" // for gGridChoice
-#include "llbase64.h"
#include "llviewercontrol.h"
-#include "llkeyboard.h"
-#include "llappviewer.h" // for gDisconnected, gDisableVoice
-#include "llmutelist.h" // to check for muted avatars
-#include "llagent.h"
-#include "llvoavatarself.h"
-#include "llcachename.h"
-#include "llimview.h" // for LLIMMgr
-#include "llparcel.h"
-#include "llviewerparcelmgr.h"
-//#include "llfirstuse.h"
-#include "llspeakers.h"
-#include "lltrans.h"
#include "llviewerwindow.h"
-#include "llviewercamera.h"
-#include "llvoavatarself.h"
-#include "llvoicechannel.h"
-
-// for base64 decoding
-#include "apr_base64.h"
-
-// for SHA1 hash
-#include "apr_sha1.h"
-
-// for MD5 hash
-#include "llmd5.h"
-
-#define USE_SESSION_GROUPS 0
+#include "llvoicevivox.h"
+#include "llviewernetwork.h"
+#include "llhttpnode.h"
+#include "llnotificationsutil.h"
+#include "llsdserialize.h"
+#include "llui.h"
-static bool sConnectingToAgni = false;
-F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
+const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
const F32 LLVoiceClient::VOLUME_MIN = 0.f;
const F32 LLVoiceClient::VOLUME_DEFAULT = 0.5f;
const F32 LLVoiceClient::VOLUME_MAX = 1.0f;
-const F32 VOLUME_SCALE_VIVOX = 0.01f;
-
-const F32 SPEAKING_TIMEOUT = 1.f;
-
-const int VOICE_MAJOR_VERSION = 1;
-const int VOICE_MINOR_VERSION = 0;
-
-LLVoiceClient *gVoiceClient = NULL;
-
-// Don't retry connecting to the daemon more frequently than this:
-const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
-
-// Don't send positional updates more frequently than this:
-const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
-
-const F32 LOGIN_RETRY_SECONDS = 10.0f;
-const int MAX_LOGIN_RETRIES = 12;
-
-// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine()
-// which is treated as normal. If this number is exceeded we suspect there is a problem with connection
-// to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen
-// to make sure we don't make mistake when slight connection problems happen- situation when connection to server is
-// blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability.
-const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50;
-
-static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str)
-{
- LLMD5 md5_uuid;
- md5_uuid.update((const unsigned char*)str.data(), str.size());
- md5_uuid.finalize();
- md5_uuid.raw_digest(uuid.mData);
-}
-
-static int scale_mic_volume(float volume)
-{
- // incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.
- // Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70
- return 30 + (int)(volume * 20.0f);
-}
-
-static int scale_speaker_volume(float volume)
-{
- // incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
- // Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70
- return 30 + (int)(volume * 40.0f);
-}
-
-class LLViewerVoiceAccountProvisionResponder :
- public LLHTTPClient::Responder
-{
-public:
- LLViewerVoiceAccountProvisionResponder(int retries)
- {
- mRetries = retries;
- }
-
- virtual void error(U32 status, const std::string& reason)
- {
- if ( mRetries > 0 )
- {
- LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying. status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
- if ( gVoiceClient ) gVoiceClient->requestVoiceAccountProvision(
- mRetries - 1);
- }
- else
- {
- LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up). status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
- if ( gVoiceClient ) gVoiceClient->giveUp();
- }
- }
-
- virtual void result(const LLSD& content)
- {
- if ( gVoiceClient )
- {
- std::string voice_sip_uri_hostname;
- std::string voice_account_server_uri;
-
- LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
-
- if(content.has("voice_sip_uri_hostname"))
- voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString();
-
- // this key is actually misnamed -- it will be an entire URI, not just a hostname.
- if(content.has("voice_account_server_name"))
- voice_account_server_uri = content["voice_account_server_name"].asString();
-
- gVoiceClient->login(
- content["username"].asString(),
- content["password"].asString(),
- voice_sip_uri_hostname,
- voice_account_server_uri);
- }
- }
-
-private:
- int mRetries;
-};
-
-/**
- * @class LLVivoxProtocolParser
- * @brief This class helps construct new LLIOPipe specializations
- * @see LLIOPipe
- *
- * THOROUGH_DESCRIPTION
- */
-class LLVivoxProtocolParser : public LLIOPipe
-{
- LOG_CLASS(LLVivoxProtocolParser);
-public:
- LLVivoxProtocolParser();
- virtual ~LLVivoxProtocolParser();
-
-protected:
- /* @name LLIOPipe virtual implementations
- */
- //@{
- /**
- * @brief Process the data in buffer
- */
- virtual EStatus process_impl(
- const LLChannelDescriptors& channels,
- buffer_ptr_t& buffer,
- bool& eos,
- LLSD& context,
- LLPumpIO* pump);
- //@}
-
- std::string mInput;
-
- // Expat control members
- XML_Parser parser;
- int responseDepth;
- bool ignoringTags;
- bool isEvent;
- int ignoreDepth;
-
- // Members for processing responses. The values are transient and only valid within a call to processResponse().
- bool squelchDebugOutput;
- int returnCode;
- int statusCode;
- std::string statusString;
- std::string requestId;
- std::string actionString;
- std::string connectorHandle;
- std::string versionID;
- std::string accountHandle;
- std::string sessionHandle;
- std::string sessionGroupHandle;
- std::string alias;
- std::string applicationString;
-
- // Members for processing events. The values are transient and only valid within a call to processResponse().
- std::string eventTypeString;
- int state;
- std::string uriString;
- bool isChannel;
- bool incoming;
- bool enabled;
- std::string nameString;
- std::string audioMediaString;
- std::string displayNameString;
- std::string deviceString;
- int participantType;
- bool isLocallyMuted;
- bool isModeratorMuted;
- bool isSpeaking;
- int volume;
- F32 energy;
- std::string messageHeader;
- std::string messageBody;
- std::string notificationType;
- bool hasText;
- bool hasAudio;
- bool hasVideo;
- bool terminated;
- std::string blockMask;
- std::string presenceOnly;
- std::string autoAcceptMask;
- std::string autoAddAsBuddy;
- int numberOfAliases;
- std::string subscriptionHandle;
- std::string subscriptionType;
-
-
- // Members for processing text between tags
- std::string textBuffer;
- bool accumulateText;
-
- void reset();
-
- void processResponse(std::string tag);
-
-static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
-static void XMLCALL ExpatEndTag(void *data, const char *el);
-static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
-
- void StartTag(const char *tag, const char **attr);
- void EndTag(const char *tag);
- void CharData(const char *buffer, int length);
-
-};
-
-LLVivoxProtocolParser::LLVivoxProtocolParser()
-{
- parser = NULL;
- parser = XML_ParserCreate(NULL);
-
- reset();
-}
-
-void LLVivoxProtocolParser::reset()
-{
- responseDepth = 0;
- ignoringTags = false;
- accumulateText = false;
- energy = 0.f;
- hasText = false;
- hasAudio = false;
- hasVideo = false;
- terminated = false;
- ignoreDepth = 0;
- isChannel = false;
- incoming = false;
- enabled = false;
- isEvent = false;
- isLocallyMuted = false;
- isModeratorMuted = false;
- isSpeaking = false;
- participantType = 0;
- squelchDebugOutput = false;
- returnCode = -1;
- state = 0;
- statusCode = 0;
- volume = 0;
- textBuffer.clear();
- alias.clear();
- numberOfAliases = 0;
- applicationString.clear();
-}
-
-//virtual
-LLVivoxProtocolParser::~LLVivoxProtocolParser()
-{
- if (parser)
- XML_ParserFree(parser);
-}
-
-// virtual
-LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
- const LLChannelDescriptors& channels,
- buffer_ptr_t& buffer,
- bool& eos,
- LLSD& context,
- LLPumpIO* pump)
-{
- LLBufferStream istr(channels, buffer.get());
- std::ostringstream ostr;
- while (istr.good())
- {
- char buf[1024];
- istr.read(buf, sizeof(buf));
- mInput.append(buf, istr.gcount());
- }
-
- // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser.
- int start = 0;
- int delim;
- while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
- {
-
- // Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
- reset();
-
- XML_ParserReset(parser, NULL);
- XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
- XML_SetCharacterDataHandler(parser, ExpatCharHandler);
- XML_SetUserData(parser, this);
- XML_Parse(parser, mInput.data() + start, delim - start, false);
-
- // If this message isn't set to be squelched, output the raw XML received.
- if(!squelchDebugOutput)
- {
- LL_DEBUGS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
- }
-
- start = delim + 3;
- }
-
- if(start != 0)
- mInput = mInput.substr(start);
-
- LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
-
- if(!gVoiceClient->mConnected)
- {
- // If voice has been disabled, we just want to close the socket. This does so.
- LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
- return STATUS_STOP;
- }
-
- return STATUS_OK;
-}
-
-void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
-{
- if (data)
- {
- LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
- object->StartTag(el, attr);
- }
-}
-
-// --------------------------------------------------------------------------------
-
-void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
-{
- if (data)
- {
- LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
- object->EndTag(el);
- }
-}
-
-// --------------------------------------------------------------------------------
-
-void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
-{
- if (data)
- {
- LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
- object->CharData(s, len);
- }
-}
-
-// --------------------------------------------------------------------------------
-
-
-void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
-{
- // Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
- textBuffer.clear();
- // only accumulate text if we're not ignoring tags.
- accumulateText = !ignoringTags;
-
- if (responseDepth == 0)
- {
- isEvent = !stricmp("Event", tag);
-
- if (!stricmp("Response", tag) || isEvent)
- {
- // Grab the attributes
- while (*attr)
- {
- const char *key = *attr++;
- const char *value = *attr++;
-
- if (!stricmp("requestId", key))
- {
- requestId = value;
- }
- else if (!stricmp("action", key))
- {
- actionString = value;
- }
- else if (!stricmp("type", key))
- {
- eventTypeString = value;
- }
- }
- }
- LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
- }
- else
- {
- if (ignoringTags)
- {
- LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
-
- // Ignore the InputXml stuff so we don't get confused
- if (!stricmp("InputXml", tag))
- {
- ignoringTags = true;
- ignoreDepth = responseDepth;
- accumulateText = false;
-
- LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
- }
- else if (!stricmp("CaptureDevices", tag))
- {
- gVoiceClient->clearCaptureDevices();
- }
- else if (!stricmp("RenderDevices", tag))
- {
- gVoiceClient->clearRenderDevices();
- }
- else if (!stricmp("CaptureDevice", tag))
- {
- deviceString.clear();
- }
- else if (!stricmp("RenderDevice", tag))
- {
- deviceString.clear();
- }
- else if (!stricmp("Buddies", tag))
- {
- gVoiceClient->deleteAllBuddies();
- }
- else if (!stricmp("BlockRules", tag))
- {
- gVoiceClient->deleteAllBlockRules();
- }
- else if (!stricmp("AutoAcceptRules", tag))
- {
- gVoiceClient->deleteAllAutoAcceptRules();
- }
-
- }
- }
- responseDepth++;
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::EndTag(const char *tag)
-{
- const std::string& string = textBuffer;
-
- responseDepth--;
-
- if (ignoringTags)
- {
- if (ignoreDepth == responseDepth)
- {
- LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
- ignoringTags = false;
- }
- else
- {
- LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
- }
- }
-
- if (!ignoringTags)
- {
- LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-
- // Closing a tag. Finalize the text we've accumulated and reset
- if (!stricmp("ReturnCode", tag))
- returnCode = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("SessionHandle", tag))
- sessionHandle = string;
- else if (!stricmp("SessionGroupHandle", tag))
- sessionGroupHandle = string;
- else if (!stricmp("StatusCode", tag))
- statusCode = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("StatusString", tag))
- statusString = string;
- else if (!stricmp("ParticipantURI", tag))
- uriString = string;
- else if (!stricmp("Volume", tag))
- volume = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("Energy", tag))
- energy = (F32)strtod(string.c_str(), NULL);
- else if (!stricmp("IsModeratorMuted", tag))
- isModeratorMuted = !stricmp(string.c_str(), "true");
- else if (!stricmp("IsSpeaking", tag))
- isSpeaking = !stricmp(string.c_str(), "true");
- else if (!stricmp("Alias", tag))
- alias = string;
- else if (!stricmp("NumberOfAliases", tag))
- numberOfAliases = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("Application", tag))
- applicationString = string;
- else if (!stricmp("ConnectorHandle", tag))
- connectorHandle = string;
- else if (!stricmp("VersionID", tag))
- versionID = string;
- else if (!stricmp("AccountHandle", tag))
- accountHandle = string;
- else if (!stricmp("State", tag))
- state = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("URI", tag))
- uriString = string;
- else if (!stricmp("IsChannel", tag))
- isChannel = !stricmp(string.c_str(), "true");
- else if (!stricmp("Incoming", tag))
- incoming = !stricmp(string.c_str(), "true");
- else if (!stricmp("Enabled", tag))
- enabled = !stricmp(string.c_str(), "true");
- else if (!stricmp("Name", tag))
- nameString = string;
- else if (!stricmp("AudioMedia", tag))
- audioMediaString = string;
- else if (!stricmp("ChannelName", tag))
- nameString = string;
- else if (!stricmp("DisplayName", tag))
- displayNameString = string;
- else if (!stricmp("Device", tag))
- deviceString = string;
- else if (!stricmp("AccountName", tag))
- nameString = string;
- else if (!stricmp("ParticipantType", tag))
- participantType = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("IsLocallyMuted", tag))
- isLocallyMuted = !stricmp(string.c_str(), "true");
- else if (!stricmp("MicEnergy", tag))
- energy = (F32)strtod(string.c_str(), NULL);
- else if (!stricmp("ChannelName", tag))
- nameString = string;
- else if (!stricmp("ChannelURI", tag))
- uriString = string;
- else if (!stricmp("BuddyURI", tag))
- uriString = string;
- else if (!stricmp("Presence", tag))
- statusString = string;
- else if (!stricmp("CaptureDevice", tag))
- {
- gVoiceClient->addCaptureDevice(deviceString);
- }
- else if (!stricmp("RenderDevice", tag))
- {
- gVoiceClient->addRenderDevice(deviceString);
- }
- else if (!stricmp("Buddy", tag))
- {
- gVoiceClient->processBuddyListEntry(uriString, displayNameString);
- }
- else if (!stricmp("BlockRule", tag))
- {
- gVoiceClient->addBlockRule(blockMask, presenceOnly);
- }
- else if (!stricmp("BlockMask", tag))
- blockMask = string;
- else if (!stricmp("PresenceOnly", tag))
- presenceOnly = string;
- else if (!stricmp("AutoAcceptRule", tag))
- {
- gVoiceClient->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
- }
- else if (!stricmp("AutoAcceptMask", tag))
- autoAcceptMask = string;
- else if (!stricmp("AutoAddAsBuddy", tag))
- autoAddAsBuddy = string;
- else if (!stricmp("MessageHeader", tag))
- messageHeader = string;
- else if (!stricmp("MessageBody", tag))
- messageBody = string;
- else if (!stricmp("NotificationType", tag))
- notificationType = string;
- else if (!stricmp("HasText", tag))
- hasText = !stricmp(string.c_str(), "true");
- else if (!stricmp("HasAudio", tag))
- hasAudio = !stricmp(string.c_str(), "true");
- else if (!stricmp("HasVideo", tag))
- hasVideo = !stricmp(string.c_str(), "true");
- else if (!stricmp("Terminated", tag))
- terminated = !stricmp(string.c_str(), "true");
- else if (!stricmp("SubscriptionHandle", tag))
- subscriptionHandle = string;
- else if (!stricmp("SubscriptionType", tag))
- subscriptionType = string;
-
- textBuffer.clear();
- accumulateText= false;
-
- if (responseDepth == 0)
- {
- // We finished all of the XML, process the data
- processResponse(tag);
- }
- }
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::CharData(const char *buffer, int length)
-{
- /*
- This method is called for anything that isn't a tag, which can be text you
- want that lies between tags, and a lot of stuff you don't want like file formatting
- (tabs, spaces, CR/LF, etc).
-
- Only copy text if we are in accumulate mode...
- */
- if (accumulateText)
- textBuffer.append(buffer, length);
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::processResponse(std::string tag)
-{
- LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
-
- // SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success. This is a change vs. previous SDKs.
- // According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
- // so I believe this will give correct behavior.
-
- if(returnCode == 0)
- statusCode = 0;
-
- if (isEvent)
- {
- const char *eventTypeCstr = eventTypeString.c_str();
- if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
- {
- gVoiceClient->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
- }
- else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
- {
- /*
- <Event type="SessionAddedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
- <Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
- <IsChannel>true</IsChannel>
- <Incoming>false</Incoming>
- <ChannelName />
- </Event>
- */
- gVoiceClient->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
- }
- else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
- {
- gVoiceClient->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
- }
- else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
- {
- gVoiceClient->sessionGroupAddedEvent(sessionGroupHandle);
- }
- else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
- {
- /*
- <Event type="MediaStreamUpdatedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
- <StatusCode>200</StatusCode>
- <StatusString>OK</StatusString>
- <State>2</State>
- <Incoming>false</Incoming>
- </Event>
- */
- gVoiceClient->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
- }
- else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
- {
- /*
- <Event type="TextStreamUpdatedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==1</SessionHandle>
- <Enabled>true</Enabled>
- <State>1</State>
- <Incoming>true</Incoming>
- </Event>
- */
- gVoiceClient->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
- }
- else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
- {
- /*
- <Event type="ParticipantAddedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
- <ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
- <AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
- <DisplayName />
- <ParticipantType>0</ParticipantType>
- </Event>
- */
- gVoiceClient->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
- }
- else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
- {
- /*
- <Event type="ParticipantRemovedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
- <ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
- <AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
- </Event>
- */
- gVoiceClient->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
- }
- else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
- {
- /*
- <Event type="ParticipantUpdatedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
- <ParticipantUri>sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com</ParticipantUri>
- <IsModeratorMuted>false</IsModeratorMuted>
- <IsSpeaking>true</IsSpeaking>
- <Volume>44</Volume>
- <Energy>0.0879437</Energy>
- </Event>
- */
-
- // These happen so often that logging them is pretty useless.
- squelchDebugOutput = true;
-
- gVoiceClient->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
- }
- else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
- {
- gVoiceClient->auxAudioPropertiesEvent(energy);
- }
- else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
- {
- gVoiceClient->buddyPresenceEvent(uriString, alias, statusString, applicationString);
- }
- else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
- {
- // The buddy list was updated during parsing.
- // Need to recheck against the friends list.
- gVoiceClient->buddyListChanged();
- }
- else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
- {
- /*
- <Event type="BuddyChangedEvent">
- <AccountHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==</AccountHandle>
- <BuddyURI>sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com</BuddyURI>
- <DisplayName>Monroe Tester</DisplayName>
- <BuddyData />
- <GroupID>0</GroupID>
- <ChangeType>Set</ChangeType>
- </Event>
- */
- // TODO: Question: Do we need to process this at all?
- }
- else if (!stricmp(eventTypeCstr, "MessageEvent"))
- {
- gVoiceClient->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
- }
- else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))
- {
- gVoiceClient->sessionNotificationEvent(sessionHandle, uriString, notificationType);
- }
- else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))
- {
- gVoiceClient->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
- }
- else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))
- {
- /*
- <Event type="SessionUpdatedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
- <Uri>sip:confctl-9@bhd.vivox.com</Uri>
- <IsMuted>0</IsMuted>
- <Volume>50</Volume>
- <TransmitEnabled>1</TransmitEnabled>
- <IsFocused>0</IsFocused>
- <SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
- <SessionFontID>0</SessionFontID>
- </Event>
- */
- // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
- }
-
- else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))
- {
- /*
- <Event type="SessionGroupRemovedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- </Event>
- */
- // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
- }
- else
- {
- LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
- }
- }
- else
- {
- const char *actionCstr = actionString.c_str();
- if (!stricmp(actionCstr, "Connector.Create.1"))
- {
- gVoiceClient->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
- }
- else if (!stricmp(actionCstr, "Account.Login.1"))
- {
- gVoiceClient->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
- }
- else if (!stricmp(actionCstr, "Session.Create.1"))
- {
- gVoiceClient->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);
- }
- else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
- {
- gVoiceClient->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);
- }
- else if (!stricmp(actionCstr, "Session.Connect.1"))
- {
- gVoiceClient->sessionConnectResponse(requestId, statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Account.Logout.1"))
- {
- gVoiceClient->logoutResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
- {
- gVoiceClient->connectorShutdownResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
- {
- gVoiceClient->accountListBlockRulesResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
- {
- gVoiceClient->accountListAutoAcceptRulesResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
- {
- // We don't need to process these, but they're so spammy we don't want to log them.
- squelchDebugOutput = true;
- }
-/*
- else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
- {
- gVoiceClient->channelGetListResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
- {
-
- }
-*/
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-class LLVoiceClientMuteListObserver : public LLMuteListObserver
-{
- /* virtual */ void onChange() { gVoiceClient->muteListChanged();}
-};
-
-class LLVoiceClientFriendsObserver : public LLFriendObserver
-{
-public:
- /* virtual */ void changed(U32 mask) { gVoiceClient->updateFriends(mask);}
-};
-
-static LLVoiceClientMuteListObserver mutelist_listener;
-static bool sMuteListListener_listening = false;
-
-static LLVoiceClientFriendsObserver *friendslist_listener = NULL;
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-class LLVoiceClientCapResponder : public LLHTTPClient::Responder
-{
-public:
- LLVoiceClientCapResponder(void){};
-
- virtual void error(U32 status, const std::string& reason); // called with bad status codes
- virtual void result(const LLSD& content);
-
-private:
-};
-
-void LLVoiceClientCapResponder::error(U32 status, const std::string& reason)
-{
- LL_WARNS("Voice") << "LLVoiceClientCapResponder::error("
- << status << ": " << reason << ")"
- << LL_ENDL;
-}
-
-void LLVoiceClientCapResponder::result(const LLSD& content)
-{
- LLSD::map_const_iterator iter;
-
- LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
-
- if ( content.has("voice_credentials") )
- {
- LLSD voice_credentials = content["voice_credentials"];
- std::string uri;
- std::string credentials;
-
- if ( voice_credentials.has("channel_uri") )
- {
- uri = voice_credentials["channel_uri"].asString();
- }
- if ( voice_credentials.has("channel_credentials") )
- {
- credentials =
- voice_credentials["channel_credentials"].asString();
- }
-
- gVoiceClient->setSpatialChannel(uri, credentials);
- }
-}
-
-
-
-#if LL_WINDOWS
-static HANDLE sGatewayHandle = 0;
-
-static bool isGatewayRunning()
-{
- bool result = false;
- if(sGatewayHandle != 0)
- {
- DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0);
- if(waitresult != WAIT_OBJECT_0)
- {
- result = true;
- }
- }
- return result;
-}
-static void killGateway()
-{
- if(sGatewayHandle != 0)
- {
- TerminateProcess(sGatewayHandle,0);
- }
-}
-
-#else // Mac and linux
-
-static pid_t sGatewayPID = 0;
-static bool isGatewayRunning()
-{
- bool result = false;
- if(sGatewayPID != 0)
- {
- // A kill with signal number 0 has no effect, just does error checking. It should return an error if the process no longer exists.
- if(kill(sGatewayPID, 0) == 0)
- {
- result = true;
- }
- }
- return result;
-}
-
-static void killGateway()
-{
- if(sGatewayPID != 0)
- {
- kill(sGatewayPID, SIGTERM);
- }
-}
-
-#endif
-
-class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
-{
- LOG_CLASS(LLSpeakerVolumeStorage);
-public:
-
- /**
- * Stores volume level for specified user.
- *
- * @param[in] speaker_id - LLUUID of user to store volume level for.
- * @param[in] volume - volume level to be stored for user.
- */
- void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
-
- /**
- * Gets stored volume level for specified speaker
- *
- * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
- * @param[out] volume - set to stored volume if found, otherwise unmodified.
- * @return - true if a stored volume is found.
- */
- bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
-
- /**
- * Removes stored volume level for specified user.
- *
- * @param[in] speaker_id - LLUUID of user to remove.
- */
- void removeSpeakerVolume(const LLUUID& speaker_id);
-
-private:
- friend class LLSingleton<LLSpeakerVolumeStorage>;
- LLSpeakerVolumeStorage();
- ~LLSpeakerVolumeStorage();
-
- const static std::string SETTINGS_FILE_NAME;
-
- void load();
- void save();
-
- static F32 transformFromLegacyVolume(F32 volume_in);
- static F32 transformToLegacyVolume(F32 volume_in);
-
- typedef std::map<LLUUID, F32> speaker_data_map_t;
- speaker_data_map_t mSpeakersData;
-};
-
-const std::string LLSpeakerVolumeStorage::SETTINGS_FILE_NAME = "volume_settings.xml";
-
-LLSpeakerVolumeStorage::LLSpeakerVolumeStorage()
-{
- load();
-}
-
-LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
-{
- save();
-}
-
-void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
-{
- if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
- {
- mSpeakersData[speaker_id] = volume;
-
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "Stored volume = " << volume << " for " << id << LL_ENDL;
- }
- else
- {
- LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
- llassert(0);
- }
-}
-
-bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume)
-{
- speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
-
- if (it != mSpeakersData.end())
- {
- volume = it->second;
-
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume << " for " << id << LL_ENDL;
-
- return true;
- }
-
- return false;
-}
-
-void LLSpeakerVolumeStorage::removeSpeakerVolume(const LLUUID& speaker_id)
-{
- mSpeakersData.erase(speaker_id);
-
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "Removing stored volume for " << id << LL_ENDL;
-}
-
-/* static */ F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in)
-{
- // Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
- // from legacy characteristic composed of two square-curves
- // that intersect at volume_in = 0.5, volume_out = 0.56
-
- F32 volume_out = 0.f;
- volume_in = llclamp(volume_in, 0.f, 1.0f);
-
- if (volume_in <= 0.5f)
- {
- volume_out = volume_in * volume_in * 4.f * 0.56f;
- }
- else
- {
- volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
- }
-
- return volume_out;
-}
-
-/* static */ F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in)
-{
- // Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
- // to legacy characteristic composed of two square-curves
- // that intersect at volume_in = 0.56, volume_out = 0.5
-
- F32 volume_out = 0.f;
- volume_in = llclamp(volume_in, 0.f, 1.0f);
-
- if (volume_in <= 0.56f)
- {
- volume_out = sqrt(volume_in / (4.f * 0.56f));
- }
- else
- {
- volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
- }
-
- return volume_out;
-}
-
-void LLSpeakerVolumeStorage::load()
-{
- // load per-resident voice volume information
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
-
- LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
-
- LLSD settings_llsd;
- llifstream file;
- file.open(filename);
- if (file.is_open())
- {
- LLSDSerialize::fromXML(settings_llsd, file);
- }
-
- for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
- iter != settings_llsd.endMap(); ++iter)
- {
- // Maintain compatibility with 1.23 non-linear saved volume levels
- F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
-
- storeSpeakerVolume(LLUUID(iter->first), volume);
- }
-}
-
-void LLSpeakerVolumeStorage::save()
-{
- // If we quit from the login screen we will not have an SL account
- // name. Don't try to save, otherwise we'll dump a file in
- // C:\Program Files\SecondLife\ or similar. JC
- std::string user_dir = gDirUtilp->getLindenUserDir();
- if (!user_dir.empty())
- {
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
- LLSD settings_llsd;
-
- LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
-
- for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
- {
- // Maintain compatibility with 1.23 non-linear saved volume levels
- F32 volume = transformToLegacyVolume(iter->second);
-
- settings_llsd[iter->first.asString()] = volume;
- }
-
- llofstream file;
- file.open(filename);
- LLSDSerialize::toPrettyXML(settings_llsd, file);
- }
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-LLVoiceClient::LLVoiceClient() :
- mState(stateDisabled),
- mSessionTerminateRequested(false),
- mRelogRequested(false),
- mConnected(false),
- mPump(NULL),
- mSpatialJoiningNum(0),
-
- mTuningMode(false),
- mTuningEnergy(0.0f),
- mTuningMicVolume(0),
- mTuningMicVolumeDirty(true),
- mTuningSpeakerVolume(0),
- mTuningSpeakerVolumeDirty(true),
- mTuningExitState(stateDisabled),
-
- mAreaVoiceDisabled(false),
- mAudioSession(NULL),
- mAudioSessionChanged(false),
- mNextAudioSession(NULL),
-
- mCurrentParcelLocalID(0),
- mNumberOfAliases(0),
- mCommandCookie(0),
- mLoginRetryCount(0),
-
- mBuddyListMapPopulated(false),
- mBlockRulesListReceived(false),
- mAutoAcceptRulesListReceived(false),
- mCaptureDeviceDirty(false),
- mRenderDeviceDirty(false),
- mSpatialCoordsDirty(false),
-
- mPTTDirty(true),
- mPTT(true),
- mUsePTT(true),
- mPTTIsMiddleMouse(false),
- mPTTKey(0),
- mPTTIsToggle(false),
- mUserPTTState(false),
- mMuteMic(false),
- mFriendsListDirty(true),
-
- mEarLocation(0),
- mSpeakerVolumeDirty(true),
- mSpeakerMuteDirty(true),
- mMicVolume(0),
- mMicVolumeDirty(true),
-
- mVoiceEnabled(false),
- mWriteInProgress(false),
-
- mLipSyncEnabled(false)
-{
- gVoiceClient = this;
-
- mAPIVersion = LLTrans::getString("NotConnected");
-
- mSpeakerVolume = scale_speaker_volume(0);
-
-#if LL_DARWIN || LL_LINUX || LL_SOLARIS
- // HACK: THIS DOES NOT BELONG HERE
- // When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
- // This should cause us to ignore SIGPIPE and handle the error through proper channels.
- // This should really be set up elsewhere. Where should it go?
- signal(SIGPIPE, SIG_IGN);
-
- // Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
- // Ignoring SIGCHLD should prevent zombies from being created. Alternately, we could use wait(), but I'd rather not do that.
- signal(SIGCHLD, SIG_IGN);
-#endif
-
- // set up state machine
- setState(stateDisabled);
-
- gIdleCallbacks.addFunction(idle, this);
-}
-
-//---------------------------------------------------
-
-LLVoiceClient::~LLVoiceClient()
-{
-}
-
-//----------------------------------------------
-
-void LLVoiceClient::init(LLPumpIO *pump)
-{
- // constructor will set up gVoiceClient
- LLVoiceClient::getInstance()->mPump = pump;
- LLVoiceClient::getInstance()->updateSettings();
-}
-
-void LLVoiceClient::terminate()
-{
- if(gVoiceClient)
- {
-// gVoiceClient->leaveAudioSession();
- gVoiceClient->logout();
- // As of SDK version 4885, this should no longer be necessary. It will linger after the socket close if it needs to.
- // ms_sleep(2000);
- gVoiceClient->connectorShutdown();
- gVoiceClient->closeSocket(); // Need to do this now -- bad things happen if the destructor does it later.
-
- // This will do unpleasant things on windows.
-// killGateway();
-
- // Don't do this anymore -- LLSingleton will take care of deleting the object.
-// delete gVoiceClient;
-
- // Hint to other code not to access the voice client anymore.
- gVoiceClient = NULL;
- }
-}
-
-//---------------------------------------------------
-
-void LLVoiceClient::updateSettings()
-{
- setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
- setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
- std::string keyString = gSavedSettings.getString("PushToTalkButton");
- setPTTKey(keyString);
- setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
- setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
-
- std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
- setCaptureDevice(inputDevice);
- std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
- setRenderDevice(outputDevice);
- F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
- setMicGain(mic_level);
- setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
-}
-
-/////////////////////////////
-// utility functions
-
-bool LLVoiceClient::writeString(const std::string &str)
-{
- bool result = false;
- if(mConnected)
- {
- apr_status_t err;
- apr_size_t size = (apr_size_t)str.size();
- apr_size_t written = size;
-
- //MARK: Turn this on to log outgoing XML
-// LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
-
- // check return code - sockets will fail (broken, etc.)
- err = apr_socket_send(
- mSocket->getSocket(),
- (const char*)str.data(),
- &written);
-
- if(err == 0)
- {
- // Success.
- result = true;
- }
- // TODO: handle partial writes (written is number of bytes written)
- // Need to set socket to non-blocking before this will work.
-// else if(APR_STATUS_IS_EAGAIN(err))
-// {
-// //
-// }
- else
- {
- // Assume any socket error means something bad. For now, just close the socket.
- char buf[MAX_STRING];
- LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
- daemonDied();
- }
- }
-
- return result;
-}
-
-
-/////////////////////////////
-// session control messages
-void LLVoiceClient::connectorCreate()
-{
- std::ostringstream stream;
- std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
- std::string loglevel = "0";
-
- // Transition to stateConnectorStarted when the connector handle comes back.
- setState(stateConnectorStarting);
-
- std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel");
-
- if(savedLogLevel != "-1")
- {
- LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
- loglevel = "10";
- }
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
- << "<ClientName>V2 SDK</ClientName>"
- << "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
- << "<Mode>Normal</Mode>"
- << "<Logging>"
- << "<Folder>" << logpath << "</Folder>"
- << "<FileNamePrefix>Connector</FileNamePrefix>"
- << "<FileNameSuffix>.log</FileNameSuffix>"
- << "<LogLevel>" << loglevel << "</LogLevel>"
- << "</Logging>"
- << "<Application>SecondLifeViewer.1</Application>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::connectorShutdown()
-{
- setState(stateConnectorStopping);
-
- if(!mConnectorHandle.empty())
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
- << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
- << "</Request>"
- << "\n\n\n";
-
- mConnectorHandle.clear();
-
- writeString(stream.str());
- }
-}
-
-void LLVoiceClient::userAuthorized(const std::string& firstName, const std::string& lastName, const LLUUID &agentID)
-{
- mAccountFirstName = firstName;
- mAccountLastName = lastName;
-
- mAccountDisplayName = firstName;
- mAccountDisplayName += " ";
- mAccountDisplayName += lastName;
-
- LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
-
- sConnectingToAgni = LLViewerLogin::getInstance()->isInProductionGrid();
-
- mAccountName = nameFromID(agentID);
-}
-
-void LLVoiceClient::requestVoiceAccountProvision(S32 retries)
-{
- if ( gAgent.getRegion() && mVoiceEnabled )
- {
- std::string url =
- gAgent.getRegion()->getCapability(
- "ProvisionVoiceAccountRequest");
-
- if ( url == "" ) return;
-
- LLHTTPClient::post(
- url,
- LLSD(),
- new LLViewerVoiceAccountProvisionResponder(retries));
- }
-}
-
-void LLVoiceClient::login(
- const std::string& account_name,
- const std::string& password,
- const std::string& voice_sip_uri_hostname,
- const std::string& voice_account_server_uri)
-{
- mVoiceSIPURIHostName = voice_sip_uri_hostname;
- mVoiceAccountServerURI = voice_account_server_uri;
-
- if(!mAccountHandle.empty())
- {
- // Already logged in.
- LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
-
- // Don't process another login.
- return;
- }
- else if ( account_name != mAccountName )
- {
- //TODO: error?
- LL_WARNS("Voice") << "Wrong account name! " << account_name
- << " instead of " << mAccountName << LL_ENDL;
- }
- else
- {
- mAccountPassword = password;
- }
-
- std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
-
- if( !debugSIPURIHostName.empty() )
- {
- mVoiceSIPURIHostName = debugSIPURIHostName;
- }
-
- if( mVoiceSIPURIHostName.empty() )
- {
- // we have an empty account server name
- // so we fall back to hardcoded defaults
-
- if(sConnectingToAgni)
- {
- // Use the release account server
- mVoiceSIPURIHostName = "bhr.vivox.com";
- }
- else
- {
- // Use the development account server
- mVoiceSIPURIHostName = "bhd.vivox.com";
- }
- }
-
- std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
-
- if( !debugAccountServerURI.empty() )
- {
- mVoiceAccountServerURI = debugAccountServerURI;
- }
-
- if( mVoiceAccountServerURI.empty() )
- {
- // If the account server URI isn't specified, construct it from the SIP URI hostname
- mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";
- }
-}
-
-void LLVoiceClient::idle(void* user_data)
-{
- LLVoiceClient* self = (LLVoiceClient*)user_data;
- self->stateMachine();
-}
-
-std::string LLVoiceClient::state2string(LLVoiceClient::state inState)
-{
- std::string result = "UNKNOWN";
-
- // Prevent copy-paste errors when updating this list...
-#define CASE(x) case x: result = #x; break
-
- switch(inState)
- {
- CASE(stateDisableCleanup);
- CASE(stateDisabled);
- CASE(stateStart);
- CASE(stateDaemonLaunched);
- CASE(stateConnecting);
- CASE(stateConnected);
- CASE(stateIdle);
- CASE(stateMicTuningStart);
- CASE(stateMicTuningRunning);
- CASE(stateMicTuningStop);
- CASE(stateConnectorStart);
- CASE(stateConnectorStarting);
- CASE(stateConnectorStarted);
- CASE(stateLoginRetry);
- CASE(stateLoginRetryWait);
- CASE(stateNeedsLogin);
- CASE(stateLoggingIn);
- CASE(stateLoggedIn);
- CASE(stateCreatingSessionGroup);
- CASE(stateNoChannel);
- CASE(stateJoiningSession);
- CASE(stateSessionJoined);
- CASE(stateRunning);
- CASE(stateLeavingSession);
- CASE(stateSessionTerminated);
- CASE(stateLoggingOut);
- CASE(stateLoggedOut);
- CASE(stateConnectorStopping);
- CASE(stateConnectorStopped);
- CASE(stateConnectorFailed);
- CASE(stateConnectorFailedWaiting);
- CASE(stateLoginFailed);
- CASE(stateLoginFailedWaiting);
- CASE(stateJoinSessionFailed);
- CASE(stateJoinSessionFailedWaiting);
- CASE(stateJail);
- }
-
-#undef CASE
-
- return result;
-}
-
std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
{
std::string result = "UNKNOWN";
- // Prevent copy-paste errors when updating this list...
+ // Prevent copy-paste errors when updating this list...
#define CASE(x) case x: result = #x; break
-
+
switch(inStatus)
{
- CASE(STATUS_LOGIN_RETRY);
- CASE(STATUS_LOGGED_IN);
- CASE(STATUS_JOINING);
- CASE(STATUS_JOINED);
- CASE(STATUS_LEFT_CHANNEL);
- CASE(STATUS_VOICE_DISABLED);
- CASE(STATUS_VOICE_ENABLED);
- CASE(BEGIN_ERROR_STATUS);
- CASE(ERROR_CHANNEL_FULL);
- CASE(ERROR_CHANNEL_LOCKED);
- CASE(ERROR_NOT_AVAILABLE);
- CASE(ERROR_UNKNOWN);
- default:
- break;
+ CASE(STATUS_LOGIN_RETRY);
+ CASE(STATUS_LOGGED_IN);
+ CASE(STATUS_JOINING);
+ CASE(STATUS_JOINED);
+ CASE(STATUS_LEFT_CHANNEL);
+ CASE(STATUS_VOICE_DISABLED);
+ CASE(BEGIN_ERROR_STATUS);
+ CASE(ERROR_CHANNEL_FULL);
+ CASE(ERROR_CHANNEL_LOCKED);
+ CASE(ERROR_NOT_AVAILABLE);
+ CASE(ERROR_UNKNOWN);
+ default:
+ break;
}
-
+
#undef CASE
return result;
}
-void LLVoiceClient::setState(state inState)
-{
- LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
-
- mState = inState;
-}
-void LLVoiceClient::stateMachine()
-{
- if(gDisconnected)
- {
- // The viewer has been disconnected from the sim. Disable voice.
- setVoiceEnabled(false);
- }
-
- if(mVoiceEnabled)
- {
- updatePosition();
- }
- else if(mTuningMode)
- {
- // Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
- }
- else
- {
- if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
- {
- // User turned off voice support. Send the cleanup messages, close the socket, and reset.
- if(!mConnected)
- {
- // if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
- LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
- killGateway();
- }
-
- logout();
- connectorShutdown();
-
- setState(stateDisableCleanup);
- }
- }
-
- // Check for parcel boundary crossing
- {
- LLViewerRegion *region = gAgent.getRegion();
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-
- if(region && parcel)
- {
- S32 parcelLocalID = parcel->getLocalID();
- std::string regionName = region->getName();
- std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
-
-// LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
-
- // The region name starts out empty and gets filled in later.
- // Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
- // If either is empty, wait for the next time around.
- if(!regionName.empty())
- {
- if(!capURI.empty())
- {
- if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
- {
- // We have changed parcels. Initiate a parcel channel lookup.
- mCurrentParcelLocalID = parcelLocalID;
- mCurrentRegionName = regionName;
-
- parcelChanged();
- }
- }
- else
- {
- LL_WARNS_ONCE("Voice") << "region doesn't have ParcelVoiceInfoRequest capability. This is normal for a short time after teleporting, but bad if it persists for very long." << LL_ENDL;
- }
- }
- }
- }
-
- switch(getState())
- {
- //MARK: stateDisableCleanup
- case stateDisableCleanup:
- // Clean up and reset everything.
- closeSocket();
- deleteAllSessions();
- deleteAllBuddies();
-
- mConnectorHandle.clear();
- mAccountHandle.clear();
- mAccountPassword.clear();
- mVoiceAccountServerURI.clear();
-
- setState(stateDisabled);
- break;
-
- //MARK: stateDisabled
- case stateDisabled:
- if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
- {
- setState(stateStart);
- }
- break;
-
- //MARK: stateStart
- case stateStart:
- if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
- {
- // Voice is locked out, we must not launch the vivox daemon.
- setState(stateJail);
- }
- else if(!isGatewayRunning())
- {
- if(true)
- {
- // Launch the voice daemon
-
- // *FIX:Mani - Using the executable dir instead
- // of mAppRODataDir, the working directory from which the app
- // is launched.
- //std::string exe_path = gDirUtilp->getAppRODataDir();
- std::string exe_path = gDirUtilp->getExecutableDir();
- exe_path += gDirUtilp->getDirDelimiter();
-#if LL_WINDOWS
- exe_path += "SLVoice.exe";
-#elif LL_DARWIN
- exe_path += "../Resources/SLVoice";
-#else
- exe_path += "SLVoice";
-#endif
- // See if the vivox executable exists
- llstat s;
- if(!LLFile::stat(exe_path, &s))
- {
- // vivox executable exists. Build the command line and launch the daemon.
- // SLIM SDK: these arguments are no longer necessary.
-// std::string args = " -p tcp -h -c";
- std::string args;
- std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
-
- if(loglevel.empty())
- {
- loglevel = "-1"; // turn logging off completely
- }
-
- args += " -ll ";
- args += loglevel;
-
- LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
-
-#if LL_WINDOWS
- PROCESS_INFORMATION pinfo;
- STARTUPINFOW sinfo;
- memset(&sinfo, 0, sizeof(sinfo));
-
- std::string exe_dir = gDirUtilp->getExecutableDir();
-
- llutf16string exe_path16 = utf8str_to_utf16str(exe_path);
- llutf16string exe_dir16 = utf8str_to_utf16str(exe_dir);
- llutf16string args16 = utf8str_to_utf16str(args);
- // Create a writeable copy to keep Windows happy.
- U16 *argscpy_16 = new U16[args16.size() + 1];
- wcscpy_s(argscpy_16,args16.size()+1,args16.c_str());
- if(!CreateProcessW(exe_path16.c_str(), argscpy_16, NULL, NULL, FALSE, 0, NULL, exe_dir16.c_str(), &sinfo, &pinfo))
- {
-// DWORD dwErr = GetLastError();
- }
- else
- {
- // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on
- // CloseHandle(pinfo.hProcess); // stops leaks - nothing else
- sGatewayHandle = pinfo.hProcess;
- CloseHandle(pinfo.hThread); // stops leaks - nothing else
- }
-
- delete[] argscpy_16;
-#else // LL_WINDOWS
- // This should be the same for mac and linux
- {
- std::vector<std::string> arglist;
- arglist.push_back(exe_path);
-
- // Split the argument string into separate strings for each argument
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep(" ");
- tokenizer tokens(args, sep);
- tokenizer::iterator token_iter;
-
- for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
- {
- arglist.push_back(*token_iter);
- }
-
- // create an argv vector for the child process
- char **fakeargv = new char*[arglist.size() + 1];
- int i;
- for(i=0; i < arglist.size(); i++)
- fakeargv[i] = const_cast<char*>(arglist[i].c_str());
-
- fakeargv[i] = NULL;
-
- fflush(NULL); // flush all buffers before the child inherits them
- pid_t id = vfork();
- if(id == 0)
- {
- // child
- execv(exe_path.c_str(), fakeargv);
-
- // If we reach this point, the exec failed.
- // Use _exit() instead of exit() per the vfork man page.
- _exit(0);
- }
-
- // parent
- delete[] fakeargv;
- sGatewayPID = id;
- }
-#endif // LL_WINDOWS
- mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost").c_str(), gSavedSettings.getU32("VoicePort"));
- }
- else
- {
- LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
- }
- }
- else
- {
- // SLIM SDK: port changed from 44124 to 44125.
- // We can connect to a client gateway running on another host. This is useful for testing.
- // To do this, launch the gateway on a nearby host like this:
- // vivox-gw.exe -p tcp -i 0.0.0.0:44125
- // and put that host's IP address here.
- mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost"), gSavedSettings.getU32("VoicePort"));
- }
-
- mUpdateTimer.start();
- mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
-
- setState(stateDaemonLaunched);
-
- // Dirty the states we'll need to sync with the daemon when it comes up.
- mPTTDirty = true;
- mMicVolumeDirty = true;
- mSpeakerVolumeDirty = true;
- mSpeakerMuteDirty = true;
- // These only need to be set if they're not default (i.e. empty string).
- mCaptureDeviceDirty = !mCaptureDevice.empty();
- mRenderDeviceDirty = !mRenderDevice.empty();
-
- mMainSessionGroupHandle.clear();
- }
- break;
-
- //MARK: stateDaemonLaunched
- case stateDaemonLaunched:
- if(mUpdateTimer.hasExpired())
- {
- LL_DEBUGS("Voice") << "Connecting to vivox daemon" << LL_ENDL;
-
- mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
-
- if(!mSocket)
- {
- mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);
- }
-
- mConnected = mSocket->blockingConnect(mDaemonHost);
- if(mConnected)
- {
- setState(stateConnecting);
- }
- else
- {
- // If the connect failed, the socket may have been put into a bad state. Delete it.
- closeSocket();
- }
- }
- break;
-
- //MARK: stateConnecting
- case stateConnecting:
- // Can't do this until we have the pump available.
- if(mPump)
- {
- // MBW -- Note to self: pumps and pipes examples in
- // indra/test/io.cpp
- // indra/test/llpipeutil.{cpp|h}
-
- // Attach the pumps and pipes
-
- LLPumpIO::chain_t readChain;
-
- readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));
- readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser()));
-
- mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
-
- setState(stateConnected);
- }
-
- break;
-
- //MARK: stateConnected
- case stateConnected:
- // Initial devices query
- getCaptureDevicesSendMessage();
- getRenderDevicesSendMessage();
-
- mLoginRetryCount = 0;
-
- setState(stateIdle);
- break;
-
- //MARK: stateIdle
- case stateIdle:
- // This is the idle state where we're connected to the daemon but haven't set up a connector yet.
- if(mTuningMode)
- {
- mTuningExitState = stateIdle;
- setState(stateMicTuningStart);
- }
- else if(!mVoiceEnabled)
- {
- // We never started up the connector. This will shut down the daemon.
- setState(stateConnectorStopped);
- }
- else if(!mAccountName.empty())
- {
- LLViewerRegion *region = gAgent.getRegion();
-
- if(region)
- {
- if ( region->getCapability("ProvisionVoiceAccountRequest") != "" )
- {
- if ( mAccountPassword.empty() )
- {
- requestVoiceAccountProvision();
- }
- setState(stateConnectorStart);
- }
- else
- {
- LL_WARNS_ONCE("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL;
- }
- }
- }
- break;
-
- //MARK: stateMicTuningStart
- case stateMicTuningStart:
- if(mUpdateTimer.hasExpired())
- {
- if(mCaptureDeviceDirty || mRenderDeviceDirty)
- {
- // These can't be changed while in tuning mode. Set them before starting.
- std::ostringstream stream;
-
- buildSetCaptureDevice(stream);
- buildSetRenderDevice(stream);
-
- if(!stream.str().empty())
- {
- writeString(stream.str());
- }
-
- // This will come around again in the same state and start the capture, after the timer expires.
- mUpdateTimer.start();
- mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
- }
- else
- {
- // duration parameter is currently unused, per Mike S.
- tuningCaptureStartSendMessage(10000);
-
- setState(stateMicTuningRunning);
- }
- }
-
- break;
-
- //MARK: stateMicTuningRunning
- case stateMicTuningRunning:
- if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
- {
- // All of these conditions make us leave tuning mode.
- setState(stateMicTuningStop);
- }
- else
- {
- // process mic/speaker volume changes
- if(mTuningMicVolumeDirty || mTuningSpeakerVolumeDirty)
- {
- std::ostringstream stream;
-
- if(mTuningMicVolumeDirty)
- {
- LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
- << "<Level>" << mTuningMicVolume << "</Level>"
- << "</Request>\n\n\n";
- }
-
- if(mTuningSpeakerVolumeDirty)
- {
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
- << "<Level>" << mTuningSpeakerVolume << "</Level>"
- << "</Request>\n\n\n";
- }
-
- mTuningMicVolumeDirty = false;
- mTuningSpeakerVolumeDirty = false;
-
- if(!stream.str().empty())
- {
- writeString(stream.str());
- }
- }
- }
- break;
-
- //MARK: stateMicTuningStop
- case stateMicTuningStop:
- {
- // transition out of mic tuning
- tuningCaptureStopSendMessage();
-
- setState(mTuningExitState);
-
- // if we exited just to change devices, this will keep us from re-entering too fast.
- mUpdateTimer.start();
- mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-
- }
- break;
-
- //MARK: stateConnectorStart
- case stateConnectorStart:
- if(!mVoiceEnabled)
- {
- // We were never logged in. This will shut down the connector.
- setState(stateLoggedOut);
- }
- else if(!mVoiceAccountServerURI.empty())
- {
- connectorCreate();
- }
- break;
-
- //MARK: stateConnectorStarting
- case stateConnectorStarting: // waiting for connector handle
- // connectorCreateResponse() will transition from here to stateConnectorStarted.
- break;
-
- //MARK: stateConnectorStarted
- case stateConnectorStarted: // connector handle received
- if(!mVoiceEnabled)
- {
- // We were never logged in. This will shut down the connector.
- setState(stateLoggedOut);
- }
- else
- {
- // The connector is started. Send a login message.
- setState(stateNeedsLogin);
- }
- break;
-
- //MARK: stateLoginRetry
- case stateLoginRetry:
- if(mLoginRetryCount == 0)
- {
- // First retry -- display a message to the user
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGIN_RETRY);
- }
-
- mLoginRetryCount++;
-
- if(mLoginRetryCount > MAX_LOGIN_RETRIES)
- {
- LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
- setState(stateLoginFailed);
- }
- else
- {
- LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
- mUpdateTimer.start();
- mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
- setState(stateLoginRetryWait);
- }
- break;
-
- //MARK: stateLoginRetryWait
- case stateLoginRetryWait:
- if(mUpdateTimer.hasExpired())
- {
- setState(stateNeedsLogin);
- }
- break;
-
- //MARK: stateNeedsLogin
- case stateNeedsLogin:
- if(!mAccountPassword.empty())
- {
- setState(stateLoggingIn);
- loginSendMessage();
- }
- break;
-
- //MARK: stateLoggingIn
- case stateLoggingIn: // waiting for account handle
- // loginResponse() will transition from here to stateLoggedIn.
- break;
-
- //MARK: stateLoggedIn
- case stateLoggedIn: // account handle received
-
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
-
- // request the current set of block rules (we'll need them when updating the friends list)
- accountListBlockRulesSendMessage();
-
- // request the current set of auto-accept rules
- accountListAutoAcceptRulesSendMessage();
-
- // Set up the mute list observer if it hasn't been set up already.
- if((!sMuteListListener_listening))
- {
- LLMuteList::getInstance()->addObserver(&mutelist_listener);
- sMuteListListener_listening = true;
- }
-
- // Set up the friends list observer if it hasn't been set up already.
- if(friendslist_listener == NULL)
- {
- friendslist_listener = new LLVoiceClientFriendsObserver;
- LLAvatarTracker::instance().addObserver(friendslist_listener);
- }
-
- // Set the initial state of mic mute, local speaker volume, etc.
- {
- std::ostringstream stream;
-
- buildLocalAudioUpdates(stream);
-
- if(!stream.str().empty())
- {
- writeString(stream.str());
- }
- }
-
-#if USE_SESSION_GROUPS
- // create the main session group
- sessionGroupCreateSendMessage();
-
- setState(stateCreatingSessionGroup);
-#else
- // Not using session groups -- skip the stateCreatingSessionGroup state.
- setState(stateNoChannel);
-
- // Initial kick-off of channel lookup logic
- parcelChanged();
-#endif
- break;
-
- //MARK: stateCreatingSessionGroup
- case stateCreatingSessionGroup:
- if(mSessionTerminateRequested || !mVoiceEnabled)
- {
- // TODO: Question: is this the right way out of this state
- setState(stateSessionTerminated);
- }
- else if(!mMainSessionGroupHandle.empty())
- {
- setState(stateNoChannel);
-
- // Start looped recording (needed for "panic button" anti-griefing tool)
- recordingLoopStart();
- // Initial kick-off of channel lookup logic
- parcelChanged();
- }
- break;
-
- //MARK: stateNoChannel
- case stateNoChannel:
-
- mSpatialJoiningNum = 0;
- // Do this here as well as inside sendPositionalUpdate().
- // Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync.
- sendFriendsListUpdates();
-
- if(mSessionTerminateRequested || !mVoiceEnabled)
- {
- // TODO: Question: Is this the right way out of this state?
- setState(stateSessionTerminated);
- }
- else if(mTuningMode)
- {
- mTuningExitState = stateNoChannel;
- setState(stateMicTuningStart);
- }
- else if(sessionNeedsRelog(mNextAudioSession))
- {
- requestRelog();
- setState(stateSessionTerminated);
- }
- else if(mNextAudioSession)
- {
- sessionState *oldSession = mAudioSession;
-
- mAudioSession = mNextAudioSession;
- if(!mAudioSession->mReconnect)
- {
- mNextAudioSession = NULL;
- }
-
- // The old session may now need to be deleted.
- reapSession(oldSession);
-
- if(!mAudioSession->mHandle.empty())
- {
- // Connect to a session by session handle
-
- sessionMediaConnectSendMessage(mAudioSession);
- }
- else
- {
- // Connect to a session by URI
- sessionCreateSendMessage(mAudioSession, true, false);
- }
-
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINING);
- setState(stateJoiningSession);
- }
- else if(!mSpatialSessionURI.empty())
- {
- // If we're not headed elsewhere and have a spatial URI, return to spatial.
- switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
- }
- break;
-
- //MARK: stateJoiningSession
- case stateJoiningSession: // waiting for session handle
-
- // If this is true we have problem with connection to voice server (EXT-4313).
- // See descriptions of mSpatialJoiningNum and MAX_NORMAL_JOINING_SPATIAL_NUM.
- if(mSpatialJoiningNum == MAX_NORMAL_JOINING_SPATIAL_NUM)
- {
- // Notify observers to let them know there is problem with voice
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
- llwarns << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << llendl;
- }
- // Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for
- // example for p2p many times while waiting for response, so it can't be used to detect errors
- if(mAudioSession && mAudioSession->mIsSpatial)
- {
- mSpatialJoiningNum++;
- }
-
- // joinedAudioSession() will transition from here to stateSessionJoined.
- if(!mVoiceEnabled)
- {
- // User bailed out during connect -- jump straight to teardown.
- setState(stateSessionTerminated);
- }
- else if(mSessionTerminateRequested)
- {
- if(mAudioSession && !mAudioSession->mHandle.empty())
- {
- // Only allow direct exits from this state in p2p calls (for cancelling an invite).
- // Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
- if(mAudioSession->mIsP2P)
- {
- sessionMediaDisconnectSendMessage(mAudioSession);
- setState(stateSessionTerminated);
- }
- }
- }
- break;
-
- //MARK: stateSessionJoined
- case stateSessionJoined: // session handle received
-
- mSpatialJoiningNum = 0;
- // It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4
- // before continuing from this state. They can happen in either order, and if I don't wait for both, things can get stuck.
- // For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined.
- // This is a cheap way to make sure both have happened before proceeding.
- if(mAudioSession && mAudioSession->mVoiceEnabled)
- {
- // Dirty state that may need to be sync'ed with the daemon.
- mPTTDirty = true;
- mSpeakerVolumeDirty = true;
- mSpatialCoordsDirty = true;
-
- setState(stateRunning);
-
- // Start the throttle timer
- mUpdateTimer.start();
- mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-
- // Events that need to happen when a session is joined could go here.
- // Maybe send initial spatial data?
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
-
- }
- else if(!mVoiceEnabled)
- {
- // User bailed out during connect -- jump straight to teardown.
- setState(stateSessionTerminated);
- }
- else if(mSessionTerminateRequested)
- {
- // Only allow direct exits from this state in p2p calls (for cancelling an invite).
- // Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
- if(mAudioSession && mAudioSession->mIsP2P)
- {
- sessionMediaDisconnectSendMessage(mAudioSession);
- setState(stateSessionTerminated);
- }
- }
- break;
-
- //MARK: stateRunning
- case stateRunning: // steady state
- // Disabling voice or disconnect requested.
- if(!mVoiceEnabled || mSessionTerminateRequested)
- {
- leaveAudioSession();
- }
- else
- {
-
- // Figure out whether the PTT state needs to change
- {
- bool newPTT;
- if(mUsePTT)
- {
- // If configured to use PTT, track the user state.
- newPTT = mUserPTTState;
- }
- else
- {
- // If not configured to use PTT, it should always be true (otherwise the user will be unable to speak).
- newPTT = true;
- }
-
- if(mMuteMic)
- {
- // This always overrides any other PTT setting.
- newPTT = false;
- }
-
- // Dirty if state changed.
- if(newPTT != mPTT)
- {
- mPTT = newPTT;
- mPTTDirty = true;
- }
- }
-
- if(!inSpatialChannel())
- {
- // When in a non-spatial channel, never send positional updates.
- mSpatialCoordsDirty = false;
- }
- else
- {
- // Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position)
- enforceTether();
- }
-
- // Send an update only if the ptt or mute state has changed (which shouldn't be able to happen that often
- // -- the user can only click so fast) or every 10hz, whichever is sooner.
- // Sending for every volume update causes an excessive flood of messages whenever a volume slider is dragged.
- if((mAudioSession && mAudioSession->mMuteDirty) || mPTTDirty || mUpdateTimer.hasExpired())
- {
- mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
- sendPositionalUpdate();
- }
- }
- break;
-
- //MARK: stateLeavingSession
- case stateLeavingSession: // waiting for terminate session response
- // The handler for the Session.Terminate response will transition from here to stateSessionTerminated.
- break;
-
- //MARK: stateSessionTerminated
- case stateSessionTerminated:
-
- // Must do this first, since it uses mAudioSession.
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
-
- if(mAudioSession)
- {
- sessionState *oldSession = mAudioSession;
-
- mAudioSession = NULL;
- // We just notified status observers about this change. Don't do it again.
- mAudioSessionChanged = false;
-
- // The old session may now need to be deleted.
- reapSession(oldSession);
- }
- else
- {
- LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
- }
-
- // Always reset the terminate request flag when we get here.
- mSessionTerminateRequested = false;
-
- if(mVoiceEnabled && !mRelogRequested)
- {
- // Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
- setState(stateNoChannel);
- }
- else
- {
- // Shutting down voice, continue with disconnecting.
- logout();
-
- // The state machine will take it from here
- mRelogRequested = false;
- }
-
- break;
-
- //MARK: stateLoggingOut
- case stateLoggingOut: // waiting for logout response
- // The handler for the AccountLoginStateChangeEvent will transition from here to stateLoggedOut.
- break;
-
- //MARK: stateLoggedOut
- case stateLoggedOut: // logout response received
-
- // Once we're logged out, all these things are invalid.
- mAccountHandle.clear();
- deleteAllSessions();
- deleteAllBuddies();
-
- if(mVoiceEnabled && !mRelogRequested)
- {
- // User was logged out, but wants to be logged in. Send a new login request.
- setState(stateNeedsLogin);
- }
- else
- {
- // shut down the connector
- connectorShutdown();
- }
- break;
-
- //MARK: stateConnectorStopping
- case stateConnectorStopping: // waiting for connector stop
- // The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped.
- break;
-
- //MARK: stateConnectorStopped
- case stateConnectorStopped: // connector stop received
- setState(stateDisableCleanup);
- break;
-
- //MARK: stateConnectorFailed
- case stateConnectorFailed:
- setState(stateConnectorFailedWaiting);
- break;
- //MARK: stateConnectorFailedWaiting
- case stateConnectorFailedWaiting:
- if(!mVoiceEnabled)
- {
- setState(stateDisableCleanup);
- }
- break;
-
- //MARK: stateLoginFailed
- case stateLoginFailed:
- setState(stateLoginFailedWaiting);
- break;
- //MARK: stateLoginFailedWaiting
- case stateLoginFailedWaiting:
- if(!mVoiceEnabled)
- {
- setState(stateDisableCleanup);
- }
- break;
-
- //MARK: stateJoinSessionFailed
- case stateJoinSessionFailed:
- // Transition to error state. Send out any notifications here.
- if(mAudioSession)
- {
- LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mAudioSession->mErrorStatusCode << "): " << mAudioSession->mErrorStatusString << LL_ENDL;
- }
- else
- {
- LL_WARNS("Voice") << "stateJoinSessionFailed with no current session" << LL_ENDL;
- }
-
- notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
- setState(stateJoinSessionFailedWaiting);
- break;
-
- //MARK: stateJoinSessionFailedWaiting
- case stateJoinSessionFailedWaiting:
- // Joining a channel failed, either due to a failed channel name -> sip url lookup or an error from the join message.
- // Region crossings may leave this state and try the join again.
- if(mSessionTerminateRequested)
- {
- setState(stateSessionTerminated);
- }
- break;
-
- //MARK: stateJail
- case stateJail:
- // We have given up. Do nothing.
- break;
-
- }
-
- if(mAudioSession && mAudioSession->mParticipantsChanged)
- {
- mAudioSession->mParticipantsChanged = false;
- mAudioSessionChanged = true;
- }
-
- if(mAudioSessionChanged)
- {
- mAudioSessionChanged = false;
- notifyParticipantObservers();
- }
-}
-
-void LLVoiceClient::closeSocket(void)
-{
- mSocket.reset();
- mConnected = false;
-}
-
-void LLVoiceClient::loginSendMessage()
-{
- std::ostringstream stream;
-
- bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
- << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
- << "<AccountName>" << mAccountName << "</AccountName>"
- << "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
- << "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
- << "<EnableBuddiesAndPresence>true</EnableBuddiesAndPresence>"
- << "<BuddyManagementMode>Application</BuddyManagementMode>"
- << "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
- << (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::logout()
-{
- // Ensure that we'll re-request provisioning before logging in again
- mAccountPassword.clear();
- mVoiceAccountServerURI.clear();
-
- setState(stateLoggingOut);
- logoutSendMessage();
-}
-
-void LLVoiceClient::logoutSendMessage()
-{
- if(!mAccountHandle.empty())
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
-
- mAccountHandle.clear();
-
- writeString(stream.str());
- }
-}
-
-void LLVoiceClient::accountListBlockRulesSendMessage()
-{
- if(!mAccountHandle.empty())
- {
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "requesting block rules" << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListBlockRules.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
-
- writeString(stream.str());
- }
-}
-
-void LLVoiceClient::accountListAutoAcceptRulesSendMessage()
-{
- if(!mAccountHandle.empty())
- {
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "requesting auto-accept rules" << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListAutoAcceptRules.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
-
- writeString(stream.str());
- }
-}
-
-void LLVoiceClient::sessionGroupCreateSendMessage()
-{
- if(!mAccountHandle.empty())
- {
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<Type>Normal</Type>"
- << "</Request>"
- << "\n\n\n";
-
- writeString(stream.str());
- }
-}
-
-void LLVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAudio, bool startText)
-{
- LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
-
- session->mCreateInProgress = true;
- if(startAudio)
- {
- session->mMediaConnectInProgress = true;
- }
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<URI>" << session->mSIPURI << "</URI>";
-
- static const std::string allowed_chars =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "-._~";
-
- if(!session->mHash.empty())
- {
- stream
- << "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
- << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
- }
-
- stream
- << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
- << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
- << "<Name>" << mChannelName << "</Name>"
- << "</Request>\n\n\n";
- writeString(stream.str());
-}
-
-void LLVoiceClient::sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio, bool startText)
-{
- LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
-
- session->mCreateInProgress = true;
- if(startAudio)
- {
- session->mMediaConnectInProgress = true;
- }
-
- std::string password;
- if(!session->mHash.empty())
- {
- static const std::string allowed_chars =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "-._~"
- ;
- password = LLURI::escape(session->mHash, allowed_chars);
- }
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<URI>" << session->mSIPURI << "</URI>"
- << "<Name>" << mChannelName << "</Name>"
- << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
- << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
- << "<Password>" << password << "</Password>"
- << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
- << "</Request>\n\n\n"
- ;
-
- writeString(stream.str());
-}
+///////////////////////////////////////////////////////////////////////////////////////////////
-void LLVoiceClient::sessionMediaConnectSendMessage(sessionState *session)
+LLVoiceClient::LLVoiceClient()
{
- LL_DEBUGS("Voice") << "connecting audio to session handle: " << session->mHandle << LL_ENDL;
-
- session->mMediaConnectInProgress = true;
-
- std::ostringstream stream;
-
- stream
- << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "<Media>Audio</Media>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ mVoiceModule = NULL;
}
-void LLVoiceClient::sessionTextConnectSendMessage(sessionState *session)
-{
- LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
-
- std::ostringstream stream;
-
- stream
- << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
+//---------------------------------------------------
+// Basic setup/shutdown
-void LLVoiceClient::sessionTerminate()
+LLVoiceClient::~LLVoiceClient()
{
- mSessionTerminateRequested = true;
}
-void LLVoiceClient::requestRelog()
+void LLVoiceClient::init(LLPumpIO *pump)
{
- mSessionTerminateRequested = true;
- mRelogRequested = true;
+ // Initialize all of the voice modules
+ m_servicePump = pump;
}
-
-void LLVoiceClient::leaveAudioSession()
+void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
{
- if(mAudioSession)
+ // In the future, we should change this to allow voice module registration
+ // with a table lookup of sorts.
+ std::string voice_server = gSavedSettings.getString("VoiceServerType");
+ LL_DEBUGS("Voice") << "voice server type " << voice_server << LL_ENDL;
+ if(voice_server == "vivox")
{
- LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
-
- switch(getState())
- {
- case stateNoChannel:
- // In this case, we want to pretend the join failed so our state machine doesn't get stuck.
- // Skip the join failed transition state so we don't send out error notifications.
- setState(stateJoinSessionFailedWaiting);
- break;
- case stateJoiningSession:
- case stateSessionJoined:
- case stateRunning:
- if(!mAudioSession->mHandle.empty())
- {
-
-#if RECORD_EVERYTHING
- // HACK: for testing only
- // Save looped recording
- std::string savepath("/tmp/vivoxrecording");
- {
- time_t now = time(NULL);
- const size_t BUF_SIZE = 64;
- char time_str[BUF_SIZE]; /* Flawfinder: ignore */
-
- strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
- savepath += time_str;
- }
- recordingLoopSave(savepath);
-#endif
-
- sessionMediaDisconnectSendMessage(mAudioSession);
- setState(stateLeavingSession);
- }
- else
- {
- LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;
- setState(stateSessionTerminated);
- }
- break;
- case stateJoinSessionFailed:
- case stateJoinSessionFailedWaiting:
- setState(stateSessionTerminated);
- break;
-
- default:
- LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
- break;
- }
+ mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance();
}
else
{
- LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
- setState(stateSessionTerminated);
+ mVoiceModule = NULL;
+ return;
}
+ mVoiceModule->init(m_servicePump);
+ mVoiceModule->userAuthorized(user_id, agentID);
}
-void LLVoiceClient::sessionTerminateSendMessage(sessionState *session)
-{
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::sessionGroupTerminateSendMessage(sessionState *session)
-{
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-void LLVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session)
-{
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "<Media>Audio</Media>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-
-}
-
-void LLVoiceClient::sessionTextDisconnectSendMessage(sessionState *session)
-{
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.TextDisconnect.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::getCaptureDevicesSendMessage()
-{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::getRenderDevicesSendMessage()
-{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::clearCaptureDevices()
-{
- LL_DEBUGS("Voice") << "called" << LL_ENDL;
- mCaptureDevices.clear();
-}
-
-void LLVoiceClient::addCaptureDevice(const std::string& name)
-{
- LL_DEBUGS("Voice") << name << LL_ENDL;
-
- mCaptureDevices.push_back(name);
-}
-
-LLVoiceClient::deviceList *LLVoiceClient::getCaptureDevices()
+void LLVoiceClient::terminate()
{
- return &mCaptureDevices;
+ if (mVoiceModule) mVoiceModule->terminate();
+ mVoiceModule = NULL;
}
-void LLVoiceClient::setCaptureDevice(const std::string& name)
+const LLVoiceVersionInfo LLVoiceClient::getVersion()
{
- if(name == "Default")
+ if (mVoiceModule)
{
- if(!mCaptureDevice.empty())
- {
- mCaptureDevice.clear();
- mCaptureDeviceDirty = true;
- }
+ return mVoiceModule->getVersion();
}
else
{
- if(mCaptureDevice != name)
- {
- mCaptureDevice = name;
- mCaptureDeviceDirty = true;
- }
+ LLVoiceVersionInfo result;
+ result.serverVersion = std::string();
+ result.serverType = std::string();
+ return result;
}
}
-void LLVoiceClient::clearRenderDevices()
-{
- LL_DEBUGS("Voice") << "called" << LL_ENDL;
- mRenderDevices.clear();
-}
-
-void LLVoiceClient::addRenderDevice(const std::string& name)
+void LLVoiceClient::updateSettings()
{
- LL_DEBUGS("Voice") << name << LL_ENDL;
- mRenderDevices.push_back(name);
+ if (mVoiceModule) mVoiceModule->updateSettings();
}
-LLVoiceClient::deviceList *LLVoiceClient::getRenderDevices()
-{
- return &mRenderDevices;
-}
-
-void LLVoiceClient::setRenderDevice(const std::string& name)
-{
- if(name == "Default")
- {
- if(!mRenderDevice.empty())
- {
- mRenderDevice.clear();
- mRenderDeviceDirty = true;
- }
- }
- else
- {
- if(mRenderDevice != name)
- {
- mRenderDevice = name;
- mRenderDeviceDirty = true;
- }
- }
-
-}
+//--------------------------------------------------
+// tuning
void LLVoiceClient::tuningStart()
{
- mTuningMode = true;
- if(getState() >= stateNoChannel)
- {
- sessionTerminate();
- }
+ if (mVoiceModule) mVoiceModule->tuningStart();
}
void LLVoiceClient::tuningStop()
{
- mTuningMode = false;
+ if (mVoiceModule) mVoiceModule->tuningStop();
}
bool LLVoiceClient::inTuningMode()
{
- bool result = false;
- switch(getState())
- {
- case stateMicTuningRunning:
- result = true;
- break;
- default:
- break;
- }
- return result;
-}
-
-void LLVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
-{
- mTuningAudioFile = name;
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
- << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
- << "<Loop>" << (loop?"1":"0") << "</Loop>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::tuningRenderStopSendMessage()
-{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
- << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::tuningCaptureStartSendMessage(int duration)
-{
- LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
- << "<Duration>" << duration << "</Duration>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-}
-
-void LLVoiceClient::tuningCaptureStopSendMessage()
-{
- LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
-
- mTuningEnergy = 0.0f;
-}
-
-void LLVoiceClient::tuningSetMicVolume(float volume)
-{
- int scaled_volume = scale_mic_volume(volume);
-
- if(scaled_volume != mTuningMicVolume)
- {
- mTuningMicVolume = scaled_volume;
- mTuningMicVolumeDirty = true;
- }
-}
-
-void LLVoiceClient::tuningSetSpeakerVolume(float volume)
-{
- int scaled_volume = scale_speaker_volume(volume);
-
- if(scaled_volume != mTuningSpeakerVolume)
+ if (mVoiceModule)
{
- mTuningSpeakerVolume = scaled_volume;
- mTuningSpeakerVolumeDirty = true;
- }
-}
-
-float LLVoiceClient::tuningGetEnergy(void)
-{
- return mTuningEnergy;
-}
-
-bool LLVoiceClient::deviceSettingsAvailable()
-{
- bool result = true;
-
- if(!mConnected)
- result = false;
-
- if(mRenderDevices.empty())
- result = false;
-
- return result;
-}
-
-void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
-{
- if(clearCurrentList)
- {
- clearCaptureDevices();
- clearRenderDevices();
- }
- getCaptureDevicesSendMessage();
- getRenderDevicesSendMessage();
-}
-
-void LLVoiceClient::daemonDied()
-{
- // The daemon died, so the connection is gone. Reset everything and start over.
- LL_WARNS("Voice") << "Connection to vivox daemon lost. Resetting state."<< LL_ENDL;
-
- // Try to relaunch the daemon
- setState(stateDisableCleanup);
-}
-
-void LLVoiceClient::giveUp()
-{
- // All has failed. Clean up and stop trying.
- closeSocket();
- deleteAllSessions();
- deleteAllBuddies();
-
- setState(stateJail);
-}
-
-static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
-{
- F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the new position and velocity
- F64 npos[3];
-
- // The original XML command was sent like this:
- /*
- << "<Position>"
- << "<X>" << pos[VX] << "</X>"
- << "<Y>" << pos[VZ] << "</Y>"
- << "<Z>" << pos[VY] << "</Z>"
- << "</Position>"
- << "<Velocity>"
- << "<X>" << mAvatarVelocity[VX] << "</X>"
- << "<Y>" << mAvatarVelocity[VZ] << "</Y>"
- << "<Z>" << mAvatarVelocity[VY] << "</Z>"
- << "</Velocity>"
- << "<AtOrientation>"
- << "<X>" << l.mV[VX] << "</X>"
- << "<Y>" << u.mV[VX] << "</Y>"
- << "<Z>" << a.mV[VX] << "</Z>"
- << "</AtOrientation>"
- << "<UpOrientation>"
- << "<X>" << l.mV[VZ] << "</X>"
- << "<Y>" << u.mV[VY] << "</Y>"
- << "<Z>" << a.mV[VZ] << "</Z>"
- << "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VY] << "</X>"
- << "<Y>" << u.mV [VZ] << "</Y>"
- << "<Z>" << a.mV [VY] << "</Z>"
- << "</LeftOrientation>";
- */
-
-#if 1
- // This was the original transform done when building the XML command
- nat[0] = left.mV[VX];
- nat[1] = up.mV[VX];
- nat[2] = at.mV[VX];
-
- nup[0] = left.mV[VZ];
- nup[1] = up.mV[VY];
- nup[2] = at.mV[VZ];
-
- nl[0] = left.mV[VY];
- nl[1] = up.mV[VZ];
- nl[2] = at.mV[VY];
-
- npos[0] = pos.mdV[VX];
- npos[1] = pos.mdV[VZ];
- npos[2] = pos.mdV[VY];
-
- nvel[0] = vel.mV[VX];
- nvel[1] = vel.mV[VZ];
- nvel[2] = vel.mV[VY];
-
- for(int i=0;i<3;++i) {
- at.mV[i] = nat[i];
- up.mV[i] = nup[i];
- left.mV[i] = nl[i];
- pos.mdV[i] = npos[i];
+ return mVoiceModule->inTuningMode();
}
-
- // This was the original transform done in the SDK
- nat[0] = at.mV[2];
- nat[1] = 0; // y component of at vector is always 0, this was up[2]
- nat[2] = -1 * left.mV[2];
-
- // We override whatever the application gives us
- nup[0] = 0; // x component of up vector is always 0
- nup[1] = 1; // y component of up vector is always 1
- nup[2] = 0; // z component of up vector is always 0
-
- nl[0] = at.mV[0];
- nl[1] = 0; // y component of left vector is always zero, this was up[0]
- nl[2] = -1 * left.mV[0];
-
- npos[2] = pos.mdV[2] * -1.0;
- npos[1] = pos.mdV[1];
- npos[0] = pos.mdV[0];
-
- for(int i=0;i<3;++i) {
- at.mV[i] = nat[i];
- up.mV[i] = nup[i];
- left.mV[i] = nl[i];
- pos.mdV[i] = npos[i];
- }
-#else
- // This is the compose of the two transforms (at least, that's what I'm trying for)
- nat[0] = at.mV[VX];
- nat[1] = 0; // y component of at vector is always 0, this was up[2]
- nat[2] = -1 * up.mV[VZ];
-
- // We override whatever the application gives us
- nup[0] = 0; // x component of up vector is always 0
- nup[1] = 1; // y component of up vector is always 1
- nup[2] = 0; // z component of up vector is always 0
-
- nl[0] = left.mV[VX];
- nl[1] = 0; // y component of left vector is always zero, this was up[0]
- nl[2] = -1 * left.mV[VY];
-
- npos[0] = pos.mdV[VX];
- npos[1] = pos.mdV[VZ];
- npos[2] = pos.mdV[VY] * -1.0;
-
- nvel[0] = vel.mV[VX];
- nvel[1] = vel.mV[VZ];
- nvel[2] = vel.mV[VY];
-
- for(int i=0;i<3;++i) {
- at.mV[i] = nat[i];
- up.mV[i] = nup[i];
- left.mV[i] = nl[i];
- pos.mdV[i] = npos[i];
- }
-
-#endif
-}
-
-void LLVoiceClient::sendPositionalUpdate(void)
-{
- std::ostringstream stream;
-
- if(mSpatialCoordsDirty)
- {
- LLVector3 l, u, a, vel;
- LLVector3d pos;
-
- mSpatialCoordsDirty = false;
-
- // Always send both speaker and listener positions together.
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"
- << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
-
- stream << "<SpeakerPosition>";
-
-// LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
- l = mAvatarRot.getLeftRow();
- u = mAvatarRot.getUpRow();
- a = mAvatarRot.getFwdRow();
- pos = mAvatarPosition;
- vel = mAvatarVelocity;
-
- // SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
- // The old transform is replicated by this function.
- oldSDKTransform(l, u, a, pos, vel);
-
- stream
- << "<Position>"
- << "<X>" << pos.mdV[VX] << "</X>"
- << "<Y>" << pos.mdV[VY] << "</Y>"
- << "<Z>" << pos.mdV[VZ] << "</Z>"
- << "</Position>"
- << "<Velocity>"
- << "<X>" << vel.mV[VX] << "</X>"
- << "<Y>" << vel.mV[VY] << "</Y>"
- << "<Z>" << vel.mV[VZ] << "</Z>"
- << "</Velocity>"
- << "<AtOrientation>"
- << "<X>" << a.mV[VX] << "</X>"
- << "<Y>" << a.mV[VY] << "</Y>"
- << "<Z>" << a.mV[VZ] << "</Z>"
- << "</AtOrientation>"
- << "<UpOrientation>"
- << "<X>" << u.mV[VX] << "</X>"
- << "<Y>" << u.mV[VY] << "</Y>"
- << "<Z>" << u.mV[VZ] << "</Z>"
- << "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VX] << "</X>"
- << "<Y>" << l.mV [VY] << "</Y>"
- << "<Z>" << l.mV [VZ] << "</Z>"
- << "</LeftOrientation>";
-
- stream << "</SpeakerPosition>";
-
- stream << "<ListenerPosition>";
-
- LLVector3d earPosition;
- LLVector3 earVelocity;
- LLMatrix3 earRot;
-
- switch(mEarLocation)
- {
- case earLocCamera:
- default:
- earPosition = mCameraPosition;
- earVelocity = mCameraVelocity;
- earRot = mCameraRot;
- break;
-
- case earLocAvatar:
- earPosition = mAvatarPosition;
- earVelocity = mAvatarVelocity;
- earRot = mAvatarRot;
- break;
-
- case earLocMixed:
- earPosition = mAvatarPosition;
- earVelocity = mAvatarVelocity;
- earRot = mCameraRot;
- break;
- }
-
- l = earRot.getLeftRow();
- u = earRot.getUpRow();
- a = earRot.getFwdRow();
- pos = earPosition;
- vel = earVelocity;
-
-// LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
-
- oldSDKTransform(l, u, a, pos, vel);
-
- stream
- << "<Position>"
- << "<X>" << pos.mdV[VX] << "</X>"
- << "<Y>" << pos.mdV[VY] << "</Y>"
- << "<Z>" << pos.mdV[VZ] << "</Z>"
- << "</Position>"
- << "<Velocity>"
- << "<X>" << vel.mV[VX] << "</X>"
- << "<Y>" << vel.mV[VY] << "</Y>"
- << "<Z>" << vel.mV[VZ] << "</Z>"
- << "</Velocity>"
- << "<AtOrientation>"
- << "<X>" << a.mV[VX] << "</X>"
- << "<Y>" << a.mV[VY] << "</Y>"
- << "<Z>" << a.mV[VZ] << "</Z>"
- << "</AtOrientation>"
- << "<UpOrientation>"
- << "<X>" << u.mV[VX] << "</X>"
- << "<Y>" << u.mV[VY] << "</Y>"
- << "<Z>" << u.mV[VZ] << "</Z>"
- << "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VX] << "</X>"
- << "<Y>" << l.mV [VY] << "</Y>"
- << "<Z>" << l.mV [VZ] << "</Z>"
- << "</LeftOrientation>";
-
-
- stream << "</ListenerPosition>";
-
- stream << "</Request>\n\n\n";
- }
-
- if(mAudioSession && (mAudioSession->mVolumeDirty || mAudioSession->mMuteDirty))
- {
- participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-
- mAudioSession->mVolumeDirty = false;
- mAudioSession->mMuteDirty = false;
-
- for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
- {
- participantState *p = iter->second;
-
- if(p->mVolumeDirty)
- {
- // Can't set volume/mute for yourself
- if(!p->mIsSelf)
- {
- // scale from the range 0.0-1.0 to vivox volume in the range 0-100
- S32 volume = llround(p->mVolume / VOLUME_SCALE_VIVOX);
-
- bool mute = p->mOnMuteList;
-
- if(mute)
- {
- // SetParticipantMuteForMe doesn't work in p2p sessions.
- // If we want the user to be muted, set their volume to 0 as well.
- // This isn't perfect, but it will at least reduce their volume to a minimum.
- volume = 0;
-
- // Mark the current volume level as set to prevent incoming events
- // changing it to 0, so that we can return to it when unmuting.
- p->mVolumeSet = true;
- }
-
- if(volume == 0)
- {
- mute = true;
- }
-
- LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
-
- // SLIM SDK: Send both volume and mute commands.
-
- // Send a "volume for me" command for the user.
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
- << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
- << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
- << "<Volume>" << volume << "</Volume>"
- << "</Request>\n\n\n";
-
- if(!mAudioSession->mIsP2P)
- {
- // Send a "mute for me" command for the user
- // Doesn't work in P2P sessions
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
- << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
- << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
- << "<Mute>" << (mute?"1":"0") << "</Mute>"
- << "<Scope>Audio</Scope>"
- << "</Request>\n\n\n";
- }
- }
-
- p->mVolumeDirty = false;
- }
- }
- }
-
- buildLocalAudioUpdates(stream);
-
- if(!stream.str().empty())
- {
- writeString(stream.str());
- }
-
- // Friends list updates can be huge, especially on the first voice login of an account with lots of friends.
- // Batching them all together can choke SLVoice, so send them in separate writes.
- sendFriendsListUpdates();
-}
-
-void LLVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
-{
- if(mCaptureDeviceDirty)
+ else
{
- LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
- << "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
- << "</Request>"
- << "\n\n\n";
-
- mCaptureDeviceDirty = false;
+ return false;
}
}
-void LLVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
+void LLVoiceClient::tuningSetMicVolume(float volume)
{
- if(mRenderDeviceDirty)
- {
- LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
- << "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
- << "</Request>"
- << "\n\n\n";
- mRenderDeviceDirty = false;
- }
+ if (mVoiceModule) mVoiceModule->tuningSetMicVolume(volume);
}
-void LLVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
+void LLVoiceClient::tuningSetSpeakerVolume(float volume)
{
- buildSetCaptureDevice(stream);
-
- buildSetRenderDevice(stream);
-
- if(mPTTDirty)
- {
- mPTTDirty = false;
-
- // Send a local mute command.
- // NOTE that the state of "PTT" is the inverse of "local mute".
- // (i.e. when PTT is true, we send a mute command with "false", and vice versa)
-
- LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
-
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
- << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
- << "<Value>" << (mPTT?"false":"true") << "</Value>"
- << "</Request>\n\n\n";
-
- }
-
- if(mSpeakerMuteDirty)
- {
- const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0))?"true":"false");
-
- mSpeakerMuteDirty = false;
-
- LL_INFOS("Voice") << "Setting speaker mute to " << muteval << LL_ENDL;
-
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
- << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
- << "<Value>" << muteval << "</Value>"
- << "</Request>\n\n\n";
-
- }
-
- if(mSpeakerVolumeDirty)
- {
- mSpeakerVolumeDirty = false;
-
- LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume << LL_ENDL;
-
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
- << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
- << "<Value>" << mSpeakerVolume << "</Value>"
- << "</Request>\n\n\n";
-
- }
-
- if(mMicVolumeDirty)
- {
- mMicVolumeDirty = false;
-
- LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume << LL_ENDL;
-
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
- << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
- << "<Value>" << mMicVolume << "</Value>"
- << "</Request>\n\n\n";
- }
-
-
+ if (mVoiceModule) mVoiceModule->tuningSetSpeakerVolume(volume);
}
-void LLVoiceClient::checkFriend(const LLUUID& id)
+float LLVoiceClient::tuningGetEnergy(void)
{
- std::string name;
- buddyListEntry *buddy = findBuddy(id);
-
- // Make sure we don't add a name before it's been looked up.
- if(gCacheName->getFullName(id, name))
+ if (mVoiceModule)
{
-
- const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
- bool canSeeMeOnline = false;
- if(relationInfo && relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS))
- canSeeMeOnline = true;
-
- // When we get here, mNeedsSend is true and mInSLFriends is false. Change them as necessary.
-
- if(buddy)
- {
- // This buddy is already in both lists.
-
- if(name != buddy->mDisplayName)
- {
- // The buddy is in the list with the wrong name. Update it with the correct name.
- LL_WARNS("Voice") << "Buddy " << id << " has wrong name (\"" << buddy->mDisplayName << "\" should be \"" << name << "\"), updating."<< LL_ENDL;
- buddy->mDisplayName = name;
- buddy->mNeedsNameUpdate = true; // This will cause the buddy to be resent.
- }
- }
- else
- {
- // This buddy was not in the vivox list, needs to be added.
- buddy = addBuddy(sipURIFromID(id), name);
- buddy->mUUID = id;
- }
-
- // In all the above cases, the buddy is in the SL friends list (which is how we got here).
- buddy->mInSLFriends = true;
- buddy->mCanSeeMeOnline = canSeeMeOnline;
- buddy->mNameResolved = true;
-
+ return mVoiceModule->tuningGetEnergy();
}
else
{
- // This name hasn't been looked up yet. Don't do anything with this buddy list entry until it has.
- if(buddy)
- {
- buddy->mNameResolved = false;
- }
-
- // Initiate a lookup.
- // The "lookup completed" callback will ensure that the friends list is rechecked after it completes.
- lookupName(id);
+ return 0.0;
}
}
-void LLVoiceClient::clearAllLists()
-{
- // FOR TESTING ONLY
-
- // This will send the necessary commands to delete ALL buddies, autoaccept rules, and block rules SLVoice tells us about.
- buddyListMap::iterator buddy_it;
- for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
- {
- buddyListEntry *buddy = buddy_it->second;
- buddy_it++;
-
- std::ostringstream stream;
- if(buddy->mInVivoxBuddies)
- {
- // delete this entry from the vivox buddy list
- buddy->mInVivoxBuddies = false;
- LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
- << "</Request>\n\n\n";
- }
+//------------------------------------------------
+// devices
- if(buddy->mHasBlockListEntry)
- {
- // Delete the associated block list entry (so the block list doesn't fill up with junk)
- buddy->mHasBlockListEntry = false;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BlockMask>" << buddy->mURI << "</BlockMask>"
- << "</Request>\n\n\n";
- }
- if(buddy->mHasAutoAcceptListEntry)
- {
- // Delete the associated auto-accept list entry (so the auto-accept list doesn't fill up with junk)
- buddy->mHasAutoAcceptListEntry = false;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
- << "</Request>\n\n\n";
- }
-
- writeString(stream.str());
-
- }
-}
-
-void LLVoiceClient::sendFriendsListUpdates()
+bool LLVoiceClient::deviceSettingsAvailable()
{
- if(mBuddyListMapPopulated && mBlockRulesListReceived && mAutoAcceptRulesListReceived && mFriendsListDirty)
+ if (mVoiceModule)
{
- mFriendsListDirty = false;
-
- if(0)
- {
- // FOR TESTING ONLY -- clear all buddy list, block list, and auto-accept list entries.
- clearAllLists();
- return;
- }
-
- LL_INFOS("Voice") << "Checking vivox buddy list against friends list..." << LL_ENDL;
-
- buddyListMap::iterator buddy_it;
- for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
- {
- // reset the temp flags in the local buddy list
- buddy_it->second->mInSLFriends = false;
- }
-
- // correlate with the friends list
- {
- LLCollectAllBuddies collect;
- LLAvatarTracker::instance().applyFunctor(collect);
- LLCollectAllBuddies::buddy_map_t::const_iterator it = collect.mOnline.begin();
- LLCollectAllBuddies::buddy_map_t::const_iterator end = collect.mOnline.end();
-
- for ( ; it != end; ++it)
- {
- checkFriend(it->second);
- }
- it = collect.mOffline.begin();
- end = collect.mOffline.end();
- for ( ; it != end; ++it)
- {
- checkFriend(it->second);
- }
- }
-
- LL_INFOS("Voice") << "Sending friend list updates..." << LL_ENDL;
-
- for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
- {
- buddyListEntry *buddy = buddy_it->second;
- buddy_it++;
-
- // Ignore entries that aren't resolved yet.
- if(buddy->mNameResolved)
- {
- std::ostringstream stream;
-
- if(buddy->mInSLFriends && (!buddy->mInVivoxBuddies || buddy->mNeedsNameUpdate))
- {
- if(mNumberOfAliases > 0)
- {
- // Add (or update) this entry in the vivox buddy list
- buddy->mInVivoxBuddies = true;
- buddy->mNeedsNameUpdate = false;
- LL_DEBUGS("Voice") << "add/update " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
- << "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
- << "<BuddyData></BuddyData>" // Without this, SLVoice doesn't seem to parse the command.
- << "<GroupID>0</GroupID>"
- << "</Request>\n\n\n";
- }
- }
- else if(!buddy->mInSLFriends)
- {
- // This entry no longer exists in your SL friends list. Remove all traces of it from the Vivox buddy list.
- if(buddy->mInVivoxBuddies)
- {
- // delete this entry from the vivox buddy list
- buddy->mInVivoxBuddies = false;
- LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
- << "</Request>\n\n\n";
- }
-
- if(buddy->mHasBlockListEntry)
- {
- // Delete the associated block list entry, if any
- buddy->mHasBlockListEntry = false;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BlockMask>" << buddy->mURI << "</BlockMask>"
- << "</Request>\n\n\n";
- }
- if(buddy->mHasAutoAcceptListEntry)
- {
- // Delete the associated auto-accept list entry, if any
- buddy->mHasAutoAcceptListEntry = false;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
- << "</Request>\n\n\n";
- }
- }
-
- if(buddy->mInSLFriends)
- {
-
- if(buddy->mCanSeeMeOnline)
- {
- // Buddy should not be blocked.
-
- // If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
-
- // If the buddy has a block list entry, delete it.
- if(buddy->mHasBlockListEntry)
- {
- buddy->mHasBlockListEntry = false;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BlockMask>" << buddy->mURI << "</BlockMask>"
- << "</Request>\n\n\n";
-
-
- // If we just deleted a block list entry, add an auto-accept entry.
- if(!buddy->mHasAutoAcceptListEntry)
- {
- buddy->mHasAutoAcceptListEntry = true;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateAutoAcceptRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
- << "<AutoAddAsBuddy>0</AutoAddAsBuddy>"
- << "</Request>\n\n\n";
- }
- }
- }
- else
- {
- // Buddy should be blocked.
-
- // If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
-
- // If this buddy has an autoaccept entry, delete it
- if(buddy->mHasAutoAcceptListEntry)
- {
- buddy->mHasAutoAcceptListEntry = false;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
- << "</Request>\n\n\n";
-
- // If we just deleted an auto-accept entry, add a block list entry.
- if(!buddy->mHasBlockListEntry)
- {
- buddy->mHasBlockListEntry = true;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateBlockRule.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BlockMask>" << buddy->mURI << "</BlockMask>"
- << "<PresenceOnly>1</PresenceOnly>"
- << "</Request>\n\n\n";
- }
- }
- }
-
- if(!buddy->mInSLFriends && !buddy->mInVivoxBuddies)
- {
- // Delete this entry from the local buddy list. This should NOT invalidate the iterator,
- // since it has already been incremented to the next entry.
- deleteBuddy(buddy->mURI);
- }
-
- }
- writeString(stream.str());
- }
- }
- }
-}
-
-/////////////////////////////
-// Response/Event handlers
-
-void LLVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
-{
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
- setState(stateConnectorFailed);
+ return mVoiceModule->deviceSettingsAvailable();
}
else
{
- // Connector created, move forward.
- LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
- mAPIVersion = versionID;
- mConnectorHandle = connectorHandle;
- if(getState() == stateConnectorStarting)
- {
- setState(stateConnectorStarted);
- }
+ return false;
}
}
-void LLVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
-{
- LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
-
- // Status code of 20200 means "bad password". We may want to special-case that at some point.
-
- if ( statusCode == 401 )
- {
- // Login failure which is probably caused by the delay after a user's password being updated.
- LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
- setState(stateLoginRetry);
- }
- else if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
- setState(stateLoginFailed);
- }
- else
- {
- // Login succeeded, move forward.
- mAccountHandle = accountHandle;
- mNumberOfAliases = numberOfAliases;
- // This needs to wait until the AccountLoginStateChangeEvent is received.
-// if(getState() == stateLoggingIn)
-// {
-// setState(stateLoggedIn);
-// }
- }
-}
-
-void LLVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{
- sessionState *session = findSessionBeingCreatedByURI(requestId);
-
- if(session)
- {
- session->mCreateInProgress = false;
- }
-
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
- if(session)
- {
- session->mErrorStatusCode = statusCode;
- session->mErrorStatusString = statusString;
- if(session == mAudioSession)
- {
- setState(stateJoinSessionFailed);
- }
- else
- {
- reapSession(session);
- }
- }
- }
- else
- {
- LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
- if(session)
- {
- setSessionHandle(session, sessionHandle);
- }
- }
-}
-
-void LLVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{
- sessionState *session = findSessionBeingCreatedByURI(requestId);
-
- if(session)
- {
- session->mCreateInProgress = false;
- }
-
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
- if(session)
- {
- session->mErrorStatusCode = statusCode;
- session->mErrorStatusString = statusString;
- if(session == mAudioSession)
- {
- setState(stateJoinSessionFailed);
- }
- else
- {
- reapSession(session);
- }
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
- if(session)
- {
- setSessionHandle(session, sessionHandle);
- }
- }
-}
-
-void LLVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
+void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
{
- sessionState *session = findSession(requestId);
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
- if(session)
- {
- session->mMediaConnectInProgress = false;
- session->mErrorStatusCode = statusCode;
- session->mErrorStatusString = statusString;
- if(session == mAudioSession)
- setState(stateJoinSessionFailed);
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
- }
+ if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList);
}
-void LLVoiceClient::logoutResponse(int statusCode, std::string &statusString)
-{
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
- // Should this ever fail? do we care if it does?
- }
-}
-
-void LLVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
+void LLVoiceClient::setCaptureDevice(const std::string& name)
{
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
- // Should this ever fail? do we care if it does?
- }
-
- mConnected = false;
+ if (mVoiceModule) mVoiceModule->setCaptureDevice(name);
- if(getState() == stateConnectorStopping)
- {
- setState(stateConnectorStopped);
- }
}
-void LLVoiceClient::sessionAddedEvent(
- std::string &uriString,
- std::string &alias,
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- bool isChannel,
- bool incoming,
- std::string &nameString,
- std::string &applicationString)
+void LLVoiceClient::setRenderDevice(const std::string& name)
{
- sessionState *session = NULL;
-
- LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
-
- session = addSession(uriString, sessionHandle);
- if(session)
- {
- session->mGroupHandle = sessionGroupHandle;
- session->mIsChannel = isChannel;
- session->mIncoming = incoming;
- session->mAlias = alias;
-
- // Generate a caller UUID -- don't need to do this for channels
- if(!session->mIsChannel)
- {
- if(IDFromName(session->mSIPURI, session->mCallerID))
- {
- // Normal URI(base64-encoded UUID)
- }
- else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
- {
- // Wrong URI, but an alias is available. Stash the incoming URI as an alternate
- session->mAlternateSIPURI = session->mSIPURI;
-
- // and generate a proper URI from the ID.
- setSessionURI(session, sipURIFromID(session->mCallerID));
- }
- else
- {
- LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
- setUUIDFromStringHash(session->mCallerID, session->mSIPURI);
- session->mSynthesizedCallerID = true;
-
- // Can't look up the name in this case -- we have to extract it from the URI.
- std::string namePortion = nameFromsipURI(session->mSIPURI);
- if(namePortion.empty())
- {
- // Didn't seem to be a SIP URI, just use the whole provided name.
- namePortion = nameString;
- }
-
- // Some incoming names may be separated with an underscore instead of a space. Fix this.
- LLStringUtil::replaceChar(namePortion, '_', ' ');
-
- // Act like we just finished resolving the name (this stores it in all the right places)
- avatarNameResolved(session->mCallerID, namePortion);
- }
-
- LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
-
- if(!session->mSynthesizedCallerID)
- {
- // If we got here, we don't have a proper name. Initiate a lookup.
- lookupName(session->mCallerID);
- }
- }
- }
+ if (mVoiceModule) mVoiceModule->setRenderDevice(name);
}
-void LLVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
+const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices()
{
- LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
-
-#if USE_SESSION_GROUPS
- if(mMainSessionGroupHandle.empty())
+ static LLVoiceDeviceList nullCaptureDevices;
+ if (mVoiceModule)
{
- // This is the first (i.e. "main") session group. Save its handle.
- mMainSessionGroupHandle = sessionGroupHandle;
+ return mVoiceModule->getCaptureDevices();
}
else
{
- LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
- }
-#endif
-}
-
-void LLVoiceClient::joinedAudioSession(sessionState *session)
-{
- if(mAudioSession != session)
- {
- sessionState *oldSession = mAudioSession;
-
- mAudioSession = session;
- mAudioSessionChanged = true;
-
- // The old session may now need to be deleted.
- reapSession(oldSession);
- }
-
- // This is the session we're joining.
- if(getState() == stateJoiningSession)
- {
- setState(stateSessionJoined);
-
- // SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now.
- // Add the current user as a participant here.
- participantState *participant = session->addParticipant(sipURIFromName(mAccountName));
- if(participant)
- {
- participant->mIsSelf = true;
- lookupName(participant->mAvatarID);
-
- LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName
- << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
- }
-
- if(!session->mIsChannel)
- {
- // this is a p2p session. Make sure the other end is added as a participant.
- participantState *participant = session->addParticipant(session->mSIPURI);
- if(participant)
- {
- if(participant->mAvatarIDValid)
- {
- lookupName(participant->mAvatarID);
- }
- else if(!session->mName.empty())
- {
- participant->mDisplayName = session->mName;
- avatarNameResolved(participant->mAvatarID, session->mName);
- }
-
- // TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
- LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName
- << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
- }
- }
+ return nullCaptureDevices;
}
}
-void LLVoiceClient::sessionRemovedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle)
-{
- LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
-
- sessionState *session = findSession(sessionHandle);
- if(session)
- {
- leftAudioSession(session);
-
- // This message invalidates the session's handle. Set it to empty.
- setSessionHandle(session);
-
- // This also means that the session's session group is now empty.
- // Terminate the session group so it doesn't leak.
- sessionGroupTerminateSendMessage(session);
-
- // Reset the media state (we now have no info)
- session->mMediaStreamState = streamStateUnknown;
- session->mTextStreamState = streamStateUnknown;
-
- // Conditionally delete the session
- reapSession(session);
- }
- else
- {
- LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
- }
-}
-void LLVoiceClient::reapSession(sessionState *session)
+const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
{
- if(session)
+ static LLVoiceDeviceList nullRenderDevices;
+ if (mVoiceModule)
{
- if(!session->mHandle.empty())
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL;
- }
- else if(session->mCreateInProgress)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
- }
- else if(session->mMediaConnectInProgress)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
- }
- else if(session == mAudioSession)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
- }
- else if(session == mNextAudioSession)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
- }
- else
- {
- // TODO: Question: Should we check for queued text messages here?
- // We don't have a reason to keep tracking this session, so just delete it.
- LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
- deleteSession(session);
- session = NULL;
- }
+ return mVoiceModule->getRenderDevices();
}
else
{
-// LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
+ return nullRenderDevices;
}
}
-// Returns true if the session seems to indicate we've moved to a region on a different voice server
-bool LLVoiceClient::sessionNeedsRelog(sessionState *session)
-{
- bool result = false;
-
- if(session != NULL)
- {
- // Only make this check for spatial channels (so it won't happen for group or p2p calls)
- if(session->mIsSpatial)
- {
- std::string::size_type atsign;
-
- atsign = session->mSIPURI.find("@");
-
- if(atsign != std::string::npos)
- {
- std::string urihost = session->mSIPURI.substr(atsign + 1);
- if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
- {
- // The hostname in this URI is different from what we expect. This probably means we need to relog.
-
- // We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
- // mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
-
- result = true;
- }
- }
- }
- }
-
- return result;
-}
-void LLVoiceClient::leftAudioSession(
- sessionState *session)
-{
- if(mAudioSession == session)
- {
- switch(getState())
- {
- case stateJoiningSession:
- case stateSessionJoined:
- case stateRunning:
- case stateLeavingSession:
- case stateJoinSessionFailed:
- case stateJoinSessionFailedWaiting:
- // normal transition
- LL_DEBUGS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
- setState(stateSessionTerminated);
- break;
-
- case stateSessionTerminated:
- // this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
- LL_WARNS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
- break;
-
- default:
- LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
- setState(stateSessionTerminated);
- break;
- }
- }
-}
+//--------------------------------------------------
+// participants
-void LLVoiceClient::accountLoginStateChangeEvent(
- std::string &accountHandle,
- int statusCode,
- std::string &statusString,
- int state)
+void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants)
{
- LL_DEBUGS("Voice") << "state is " << state << LL_ENDL;
- /*
- According to Mike S., status codes for this event are:
- login_state_logged_out=0,
- login_state_logged_in = 1,
- login_state_logging_in = 2,
- login_state_logging_out = 3,
- login_state_resetting = 4,
- login_state_error=100
- */
-
- switch(state)
+ if (mVoiceModule)
{
- case 1:
- if(getState() == stateLoggingIn)
- {
- setState(stateLoggedIn);
- }
- break;
-
- case 3:
- // The user is in the process of logging out.
- setState(stateLoggingOut);
- break;
-
- case 0:
- // The user has been logged out.
- setState(stateLoggedOut);
- break;
-
- default:
- //Used to be a commented out warning
- LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
- break;
- }
-}
-
-void LLVoiceClient::mediaStreamUpdatedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- int statusCode,
- std::string &statusString,
- int state,
- bool incoming)
-{
- sessionState *session = findSession(sessionHandle);
-
- LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
-
- if(session)
- {
- // We know about this session
-
- // Save the state for later use
- session->mMediaStreamState = state;
-
- switch(statusCode)
- {
- case 0:
- case 200:
- // generic success
- // Don't change the saved error code (it may have been set elsewhere)
- break;
- default:
- // save the status code for later
- session->mErrorStatusCode = statusCode;
- break;
- }
-
- switch(state)
- {
- case streamStateIdle:
- // Standard "left audio session"
- session->mVoiceEnabled = false;
- session->mMediaConnectInProgress = false;
- leftAudioSession(session);
- break;
-
- case streamStateConnected:
- session->mVoiceEnabled = true;
- session->mMediaConnectInProgress = false;
- joinedAudioSession(session);
- break;
-
- case streamStateRinging:
- if(incoming)
- {
- // Send the voice chat invite to the GUI layer
- // *TODO: Question: Should we correlate with the mute list here?
- session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
- session->mVoiceInvitePending = true;
- if(session->mName.empty())
- {
- lookupName(session->mCallerID);
- }
- else
- {
- // Act like we just finished resolving the name
- avatarNameResolved(session->mCallerID, session->mName);
- }
- }
- break;
-
- default:
- LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
- break;
-
- }
-
+ mVoiceModule->getParticipantList(participants);
}
else
{
- LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL;
+ participants = std::set<LLUUID>();
}
}
-void LLVoiceClient::textStreamUpdatedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- bool enabled,
- int state,
- bool incoming)
+bool LLVoiceClient::isParticipant(const LLUUID &speaker_id)
{
- sessionState *session = findSession(sessionHandle);
-
- if(session)
- {
- // Save the state for later use
- session->mTextStreamState = state;
-
- // We know about this session
- switch(state)
- {
- case 0: // We see this when the text stream closes
- LL_DEBUGS("Voice") << "stream closed" << LL_ENDL;
- break;
-
- case 1: // We see this on an incoming call from the Connector
- // Try to send any text messages queued for this session.
- sendQueuedTextMessages(session);
-
- // Send the text chat invite to the GUI layer
- // TODO: Question: Should we correlate with the mute list here?
- session->mTextInvitePending = true;
- if(session->mName.empty())
- {
- lookupName(session->mCallerID);
- }
- else
- {
- // Act like we just finished resolving the name
- avatarNameResolved(session->mCallerID, session->mName);
- }
- break;
-
- default:
- LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
- break;
-
- }
- }
+ if(mVoiceModule)
+ {
+ return mVoiceModule->isParticipant(speaker_id);
+ }
+ return false;
}
-void LLVoiceClient::participantAddedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- std::string &uriString,
- std::string &alias,
- std::string &nameString,
- std::string &displayNameString,
- int participantType)
-{
- sessionState *session = findSession(sessionHandle);
- if(session)
- {
- participantState *participant = session->addParticipant(uriString);
- if(participant)
- {
- participant->mAccountName = nameString;
-
- LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName
- << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-
- if(participant->mAvatarIDValid)
- {
- // Initiate a lookup
- lookupName(participant->mAvatarID);
- }
- else
- {
- // If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
- std::string namePortion = nameFromsipURI(uriString);
- if(namePortion.empty())
- {
- // Problem with the SIP URI, fall back to the display name
- namePortion = displayNameString;
- }
- if(namePortion.empty())
- {
- // Problems with both of the above, fall back to the account name
- namePortion = nameString;
- }
-
- // Set the display name (which is a hint to the active speakers window not to do its own lookup)
- participant->mDisplayName = namePortion;
- avatarNameResolved(participant->mAvatarID, namePortion);
- }
- }
- }
-}
-void LLVoiceClient::participantRemovedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- std::string &uriString,
- std::string &alias,
- std::string &nameString)
-{
- sessionState *session = findSession(sessionHandle);
- if(session)
- {
- participantState *participant = session->findParticipant(uriString);
- if(participant)
- {
- session->removeParticipant(participant);
- }
- else
- {
- LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
- }
-}
+//--------------------------------------------------
+// text chat
-void LLVoiceClient::participantUpdatedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- std::string &uriString,
- std::string &alias,
- bool isModeratorMuted,
- bool isSpeaking,
- int volume,
- F32 energy)
+BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id)
{
- sessionState *session = findSession(sessionHandle);
- if(session)
+ if (mVoiceModule)
{
- participantState *participant = session->findParticipant(uriString);
-
- if(participant)
- {
- participant->mIsSpeaking = isSpeaking;
- participant->mIsModeratorMuted = isModeratorMuted;
-
- // SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
- if (isSpeaking)
- {
- participant->mSpeakingTimeout.reset();
- participant->mPower = energy;
- }
- else
- {
- participant->mPower = 0.0f;
- }
-
- // Ignore incoming volume level if it has been explicitly set, or there
- // is a volume or mute change pending.
- if ( !participant->mVolumeSet && !participant->mVolumeDirty)
- {
- participant->mVolume = (F32)volume * VOLUME_SCALE_VIVOX;
- }
-
- // *HACK: mantipov: added while working on EXT-3544
- /*
- Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE
- LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.
-
- participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted
- Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.
- Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.
-
- But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()
- voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager
- and event is not fired.
-
- So, we have to call LLSpeakerMgr::update() here. In any case it is better than call it
- in LLCallFloater::draw()
- */
- LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
-
- // ignore session ID of local chat
- if (voice_cnl && voice_cnl->getSessionID().notNull())
- {
- LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
- if (speaker_manager)
- {
- speaker_manager->update(true);
- }
- }
- }
- else
- {
- LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
- }
+ return mVoiceModule->isSessionTextIMPossible(id);
}
else
{
- LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
- }
+ return FALSE;
+ }
}
-void LLVoiceClient::buddyPresenceEvent(
- std::string &uriString,
- std::string &alias,
- std::string &statusString,
- std::string &applicationString)
+BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id)
{
- buddyListEntry *buddy = findBuddy(uriString);
-
- if(buddy)
+ if (mVoiceModule)
{
- LL_DEBUGS("Voice") << "Presence event for " << buddy->mDisplayName << " status \"" << statusString << "\", application \"" << applicationString << "\""<< LL_ENDL;
- LL_DEBUGS("Voice") << "before: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
-
- if(applicationString.empty())
- {
- // This presence event is from a client that doesn't set up the Application string. Do things the old-skool way.
- // NOTE: this will be needed to support people who aren't on the 3010-class SDK yet.
-
- if ( stricmp("Unknown", statusString.c_str())== 0)
- {
- // User went offline with a non-SLim-enabled viewer.
- buddy->mOnlineSL = false;
- }
- else if ( stricmp("Online", statusString.c_str())== 0)
- {
- // User came online with a non-SLim-enabled viewer.
- buddy->mOnlineSL = true;
- }
- else
- {
- // If the user is online through SLim, their status will be "Online-slc", "Away", or something else.
- // NOTE: we should never see this unless someone is running an OLD version of SLim -- the versions that should be in use now all set the application string.
- buddy->mOnlineSLim = true;
- }
- }
- else if(applicationString.find("SecondLifeViewer") != std::string::npos)
- {
- // This presence event is from a viewer that sets the application string
- if ( stricmp("Unknown", statusString.c_str())== 0)
- {
- // Viewer says they're offline
- buddy->mOnlineSL = false;
- }
- else
- {
- // Viewer says they're online
- buddy->mOnlineSL = true;
- }
- }
- else
- {
- // This presence event is from something which is NOT the SL viewer (assume it's SLim).
- if ( stricmp("Unknown", statusString.c_str())== 0)
- {
- // SLim says they're offline
- buddy->mOnlineSLim = false;
- }
- else
- {
- // SLim says they're online
- buddy->mOnlineSLim = true;
- }
- }
-
- LL_DEBUGS("Voice") << "after: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
-
- // HACK -- increment the internal change serial number in the LLRelationship (without changing the actual status), so the UI notices the change.
- LLAvatarTracker::instance().setBuddyOnline(buddy->mUUID,LLAvatarTracker::instance().isBuddyOnline(buddy->mUUID));
-
- notifyFriendObservers();
+ return mVoiceModule->isSessionCallBackPossible(id);
}
else
{
- LL_DEBUGS("Voice") << "Presence for unknown buddy " << uriString << LL_ENDL;
+ return FALSE;
}
}
-void LLVoiceClient::messageEvent(
- std::string &sessionHandle,
- std::string &uriString,
- std::string &alias,
- std::string &messageHeader,
- std::string &messageBody,
- std::string &applicationString)
-{
- LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
-// LL_DEBUGS("Voice") << " header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
-
- if(messageHeader.find("text/html") != std::string::npos)
- {
- std::string message;
-
- {
- const std::string startMarker = "<body";
- const std::string startMarker2 = ">";
- const std::string endMarker = "</body>";
- const std::string startSpan = "<span";
- const std::string endSpan = "</span>";
- std::string::size_type start;
- std::string::size_type end;
-
- // Default to displaying the raw string, so the message gets through.
- message = messageBody;
-
- // Find the actual message text within the XML fragment
- start = messageBody.find(startMarker);
- start = messageBody.find(startMarker2, start);
- end = messageBody.find(endMarker);
-
- if(start != std::string::npos)
- {
- start += startMarker2.size();
-
- if(end != std::string::npos)
- end -= start;
-
- message.assign(messageBody, start, end);
- }
- else
- {
- // Didn't find a <body>, try looking for a <span> instead.
- start = messageBody.find(startSpan);
- start = messageBody.find(startMarker2, start);
- end = messageBody.find(endSpan);
-
- if(start != std::string::npos)
- {
- start += startMarker2.size();
-
- if(end != std::string::npos)
- end -= start;
-
- message.assign(messageBody, start, end);
- }
- }
- }
-
-// LL_DEBUGS("Voice") << " raw message = \n" << message << LL_ENDL;
-
- // strip formatting tags
- {
- std::string::size_type start;
- std::string::size_type end;
-
- while((start = message.find('<')) != std::string::npos)
- {
- if((end = message.find('>', start + 1)) != std::string::npos)
- {
- // Strip out the tag
- message.erase(start, (end + 1) - start);
- }
- else
- {
- // Avoid an infinite loop
- break;
- }
- }
- }
-
- // Decode ampersand-escaped chars
- {
- std::string::size_type mark = 0;
-
- // The text may contain text encoded with &lt;, &gt;, and &amp;
- mark = 0;
- while((mark = message.find("&lt;", mark)) != std::string::npos)
- {
- message.replace(mark, 4, "<");
- mark += 1;
- }
-
- mark = 0;
- while((mark = message.find("&gt;", mark)) != std::string::npos)
- {
- message.replace(mark, 4, ">");
- mark += 1;
- }
-
- mark = 0;
- while((mark = message.find("&amp;", mark)) != std::string::npos)
- {
- message.replace(mark, 5, "&");
- mark += 1;
- }
- }
-
- // strip leading/trailing whitespace (since we always seem to get a couple newlines)
- LLStringUtil::trim(message);
-
-// LL_DEBUGS("Voice") << " stripped message = \n" << message << LL_ENDL;
-
- sessionState *session = findSession(sessionHandle);
- if(session)
- {
- bool is_busy = gAgent.getBusy();
- bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
- bool is_linden = LLMuteList::getInstance()->isLinden(session->mName);
- bool quiet_chat = false;
- LLChat chat;
-
- chat.mMuted = is_muted && !is_linden;
-
- if(!chat.mMuted)
- {
- chat.mFromID = session->mCallerID;
- chat.mFromName = session->mName;
- chat.mSourceType = CHAT_SOURCE_AGENT;
-
- if(is_busy && !is_linden)
- {
- quiet_chat = true;
- // TODO: Question: Return busy mode response here? Or maybe when session is started instead?
- }
-
- LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
- gIMMgr->addMessage(session->mIMSessionID,
- session->mCallerID,
- session->mName.c_str(),
- message.c_str(),
- LLStringUtil::null, // default arg
- IM_NOTHING_SPECIAL, // default arg
- 0, // default arg
- LLUUID::null, // default arg
- LLVector3::zero, // default arg
- true); // prepend name and make it a link to the user's profile
- }
- }
- }
-}
-
-void LLVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
+BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
{
- sessionState *session = findSession(sessionHandle);
-
- if(session)
+ if (mVoiceModule)
{
- participantState *participant = session->findParticipant(uriString);
- if(participant)
- {
- if (!stricmp(notificationType.c_str(), "Typing"))
- {
- // Other end started typing
- // TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
- // It requires an LLIMInfo for the message, which we don't have here.
- }
- else if (!stricmp(notificationType.c_str(), "NotTyping"))
- {
- // Other end stopped typing
- // TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
- // It requires an LLIMInfo for the message, which we don't have here.
- }
- else
- {
- LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
- }
+ return mVoiceModule->sendTextMessage(participant_id, message);
}
else
{
- LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
- }
-}
-
-void LLVoiceClient::subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType)
-{
- buddyListEntry *buddy = findBuddy(buddyURI);
-
- if(!buddy)
- {
- // Couldn't find buddy by URI, try converting the alias...
- if(!alias.empty())
- {
- LLUUID id;
- if(IDFromName(alias, id))
- {
- buddy = findBuddy(id);
- }
- }
- }
-
- if(buddy)
- {
- std::ostringstream stream;
-
- if(buddy->mCanSeeMeOnline)
- {
- // Sending the response will create an auto-accept rule
- buddy->mHasAutoAcceptListEntry = true;
- }
- else
- {
- // Sending the response will create a block rule
- buddy->mHasBlockListEntry = true;
- }
-
- if(buddy->mInSLFriends)
- {
- buddy->mInVivoxBuddies = true;
- }
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.SendSubscriptionReply.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
- << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
- << "<RuleType>" << (buddy->mCanSeeMeOnline?"Allow":"Hide") << "</RuleType>"
- << "<AutoAccept>"<< (buddy->mInSLFriends?"1":"0")<< "</AutoAccept>"
- << "<SubscriptionHandle>" << subscriptionHandle << "</SubscriptionHandle>"
- << "</Request>"
- << "\n\n\n";
-
- writeString(stream.str());
- }
-}
-
-void LLVoiceClient::auxAudioPropertiesEvent(F32 energy)
-{
- LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
- mTuningEnergy = energy;
-}
-
-void LLVoiceClient::buddyListChanged()
-{
- // This is called after we receive a BuddyAndGroupListChangedEvent.
- mBuddyListMapPopulated = true;
- mFriendsListDirty = true;
-}
-
-void LLVoiceClient::muteListChanged()
-{
- // The user's mute list has been updated. Go through the current participant list and sync it with the mute list.
- if(mAudioSession)
- {
- participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-
- for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
- {
- participantState *p = iter->second;
-
- // Check to see if this participant is on the mute list already
- if(p->updateMuteState())
- mAudioSession->mMuteDirty = true;
- }
- }
-}
-
-void LLVoiceClient::updateFriends(U32 mask)
-{
- if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::POWERS))
- {
- // Just resend the whole friend list to the daemon
- mFriendsListDirty = true;
- }
-}
-
-/////////////////////////////
-// Managing list of participants
-LLVoiceClient::participantState::participantState(const std::string &uri) :
- mURI(uri),
- mPTT(false),
- mIsSpeaking(false),
- mIsModeratorMuted(false),
- mLastSpokeTimestamp(0.f),
- mPower(0.f),
- mVolume(VOLUME_DEFAULT),
- mOnMuteList(false),
- mVolumeSet(false),
- mVolumeDirty(false),
- mAvatarIDValid(false),
- mIsSelf(false)
-{
-}
-
-LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri)
-{
- participantState *result = NULL;
- bool useAlternateURI = false;
-
- // Note: this is mostly the body of LLVoiceClient::sessionState::findParticipant(), but since we need to know if it
- // matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
- {
- participantMap::iterator iter = mParticipantsByURI.find(&uri);
-
- if(iter == mParticipantsByURI.end())
- {
- if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
- {
- // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
- // Use mSIPURI instead, since it will be properly encoded.
- iter = mParticipantsByURI.find(&(mSIPURI));
- useAlternateURI = true;
- }
- }
-
- if(iter != mParticipantsByURI.end())
- {
- result = iter->second;
- }
- }
-
- if(!result)
- {
- // participant isn't already in one list or the other.
- result = new participantState(useAlternateURI?mSIPURI:uri);
- mParticipantsByURI.insert(participantMap::value_type(&(result->mURI), result));
- mParticipantsChanged = true;
-
- // Try to do a reverse transform on the URI to get the GUID back.
- {
- LLUUID id;
- if(IDFromName(result->mURI, id))
- {
- result->mAvatarIDValid = true;
- result->mAvatarID = id;
- }
- else
- {
- // Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
- // This tells code in LLVoiceClient that the ID will not be in the name cache.
- setUUIDFromStringHash(result->mAvatarID, uri);
- }
- }
-
- if(result->updateMuteState())
- {
- mMuteDirty = true;
- }
-
- mParticipantsByUUID.insert(participantUUIDMap::value_type(&(result->mAvatarID), result));
-
- if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
- {
- result->mVolumeDirty = true;
- mVolumeDirty = true;
- }
-
- LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
- }
-
- return result;
-}
-
-bool LLVoiceClient::participantState::updateMuteState()
-{
- bool result = false;
-
- bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
- if(mOnMuteList != isMuted)
- {
- mOnMuteList = isMuted;
- mVolumeDirty = true;
- result = true;
- }
- return result;
-}
-
-bool LLVoiceClient::participantState::isAvatar()
-{
- return mAvatarIDValid;
-}
-
-void LLVoiceClient::sessionState::removeParticipant(LLVoiceClient::participantState *participant)
-{
- if(participant)
- {
- participantMap::iterator iter = mParticipantsByURI.find(&(participant->mURI));
- participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(&(participant->mAvatarID));
-
- LL_DEBUGS("Voice") << "participant \"" << participant->mURI << "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
-
- if(iter == mParticipantsByURI.end())
- {
- LL_ERRS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
- }
- else if(iter2 == mParticipantsByUUID.end())
- {
- LL_ERRS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
- }
- else if(iter->second != iter2->second)
- {
- LL_ERRS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
- }
- else
- {
- mParticipantsByURI.erase(iter);
- mParticipantsByUUID.erase(iter2);
-
- delete participant;
- mParticipantsChanged = true;
- }
- }
-}
-
-void LLVoiceClient::sessionState::removeAllParticipants()
-{
- LL_DEBUGS("Voice") << "called" << LL_ENDL;
-
- while(!mParticipantsByURI.empty())
- {
- removeParticipant(mParticipantsByURI.begin()->second);
- }
-
- if(!mParticipantsByUUID.empty())
- {
- LL_ERRS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
- }
-}
-
-LLVoiceClient::participantMap *LLVoiceClient::getParticipantList(void)
-{
- participantMap *result = NULL;
- if(mAudioSession)
- {
- result = &(mAudioSession->mParticipantsByURI);
- }
- return result;
-}
-
-void LLVoiceClient::getParticipantsUUIDSet(std::set<LLUUID>& participant_uuids)
-{
- if (NULL == mAudioSession) return;
-
- participantUUIDMap::const_iterator it = mAudioSession->mParticipantsByUUID.begin(),
- it_end = mAudioSession->mParticipantsByUUID.end();
- for (; it != it_end; ++it)
- {
- participant_uuids.insert((*(*it).first));
- }
-}
-
-LLVoiceClient::participantState *LLVoiceClient::sessionState::findParticipant(const std::string &uri)
-{
- participantState *result = NULL;
-
- participantMap::iterator iter = mParticipantsByURI.find(&uri);
-
- if(iter == mParticipantsByURI.end())
- {
- if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
- {
- // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
- // Look up the other URI
- iter = mParticipantsByURI.find(&(mSIPURI));
- }
- }
-
- if(iter != mParticipantsByURI.end())
- {
- result = iter->second;
- }
-
- return result;
-}
-
-LLVoiceClient::participantState* LLVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
-{
- participantState * result = NULL;
- participantUUIDMap::iterator iter = mParticipantsByUUID.find(&id);
-
- if(iter != mParticipantsByUUID.end())
- {
- result = iter->second;
- }
-
- return result;
-}
-
-LLVoiceClient::participantState* LLVoiceClient::findParticipantByID(const LLUUID& id)
-{
- participantState * result = NULL;
-
- if(mAudioSession)
- {
- result = mAudioSession->findParticipantByID(id);
- }
-
- return result;
+ return FALSE;
+ }
}
-
-void LLVoiceClient::parcelChanged()
+void LLVoiceClient::endUserIMSession(const LLUUID& participant_id)
{
- if(getState() >= stateNoChannel)
- {
- // If the user is logged in, start a channel lookup.
- LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
-
- std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
- LLSD data;
- LLHTTPClient::post(
- url,
- data,
- new LLVoiceClientCapResponder);
- }
- else
+ if (mVoiceModule)
{
- // The transition to stateNoChannel needs to kick this off again.
- LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
+ mVoiceModule->endUserIMSession(participant_id);
}
}
-void LLVoiceClient::switchChannel(
- std::string uri,
- bool spatial,
- bool no_reconnect,
- bool is_p2p,
- std::string hash)
-{
- bool needsSwitch = false;
-
- LL_DEBUGS("Voice")
- << "called in state " << state2string(getState())
- << " with uri \"" << uri << "\""
- << (spatial?", spatial is true":", spatial is false")
- << LL_ENDL;
-
- switch(getState())
- {
- case stateJoinSessionFailed:
- case stateJoinSessionFailedWaiting:
- case stateNoChannel:
- // Always switch to the new URI from these states.
- needsSwitch = true;
- break;
-
- default:
- if(mSessionTerminateRequested)
- {
- // If a terminate has been requested, we need to compare against where the URI we're already headed to.
- if(mNextAudioSession)
- {
- if(mNextAudioSession->mSIPURI != uri)
- needsSwitch = true;
- }
- else
- {
- // mNextAudioSession is null -- this probably means we're on our way back to spatial.
- if(!uri.empty())
- {
- // We do want to process a switch in this case.
- needsSwitch = true;
- }
- }
- }
- else
- {
- // Otherwise, compare against the URI we're in now.
- if(mAudioSession)
- {
- if(mAudioSession->mSIPURI != uri)
- {
- needsSwitch = true;
- }
- }
- else
- {
- if(!uri.empty())
- {
- // mAudioSession is null -- it's not clear what case would cause this.
- // For now, log it as a warning and see if it ever crops up.
- LL_WARNS("Voice") << "No current audio session." << LL_ENDL;
- }
- }
- }
- break;
- }
-
- if(needsSwitch)
- {
- if(uri.empty())
- {
- // Leave any channel we may be in
- LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
-
- sessionState *oldSession = mNextAudioSession;
- mNextAudioSession = NULL;
-
- // The old session may now need to be deleted.
- reapSession(oldSession);
-
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
- }
- else
- {
- LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
-
- mNextAudioSession = addSession(uri);
- mNextAudioSession->mHash = hash;
- mNextAudioSession->mIsSpatial = spatial;
- mNextAudioSession->mReconnect = !no_reconnect;
- mNextAudioSession->mIsP2P = is_p2p;
- }
-
- if(getState() <= stateNoChannel)
- {
- // We're already set up to join a channel, just needed to fill in the session URI
- }
- else
- {
- // State machine will come around and rejoin if uri/handle is not empty.
- sessionTerminate();
- }
- }
-}
+//----------------------------------------------
+// channels
-void LLVoiceClient::joinSession(sessionState *session)
+bool LLVoiceClient::inProximalChannel()
{
- mNextAudioSession = session;
-
- if(getState() <= stateNoChannel)
+ if (mVoiceModule)
{
- // We're already set up to join a channel, just needed to fill in the session handle
+ return mVoiceModule->inProximalChannel();
}
else
{
- // State machine will come around and rejoin if uri/handle is not empty.
- sessionTerminate();
+ return false;
}
}
@@ -5453,1884 +343,608 @@ void LLVoiceClient::setNonSpatialChannel(
const std::string &uri,
const std::string &credentials)
{
- switchChannel(uri, false, false, false, credentials);
+ if (mVoiceModule) mVoiceModule->setNonSpatialChannel(uri, credentials);
}
void LLVoiceClient::setSpatialChannel(
const std::string &uri,
const std::string &credentials)
{
- mSpatialSessionURI = uri;
- mSpatialSessionCredentials = credentials;
- mAreaVoiceDisabled = mSpatialSessionURI.empty();
-
- LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
-
- if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
- {
- // User is in a non-spatial chat or joining a non-spatial chat. Don't switch channels.
- LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
- }
- else
- {
- switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
- }
+ if (mVoiceModule) mVoiceModule->setSpatialChannel(uri, credentials);
}
-void LLVoiceClient::callUser(const LLUUID &uuid)
-{
- std::string userURI = sipURIFromID(uuid);
-
- switchChannel(userURI, false, true, true);
-}
-
-LLVoiceClient::sessionState* LLVoiceClient::startUserIMSession(const LLUUID &uuid)
+void LLVoiceClient::leaveNonSpatialChannel()
{
- // Figure out if a session with the user already exists
- sessionState *session = findSession(uuid);
- if(!session)
- {
- // No session with user, need to start one.
- std::string uri = sipURIFromID(uuid);
- session = addSession(uri);
-
- llassert(session);
- if (!session) return NULL;
-
- session->mIsSpatial = false;
- session->mReconnect = false;
- session->mIsP2P = true;
- session->mCallerID = uuid;
- }
-
- if(session->mHandle.empty())
- {
- // Session isn't active -- start it up.
- sessionCreateSendMessage(session, false, true);
- }
- else
- {
- // Session is already active -- start up text.
- sessionTextConnectSendMessage(session);
- }
-
- return session;
+ if (mVoiceModule) mVoiceModule->leaveNonSpatialChannel();
}
-bool LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
+void LLVoiceClient::leaveChannel(void)
{
- bool result = false;
-
- // Attempt to locate the indicated session
- sessionState *session = startUserIMSession(participant_id);
- if(session)
- {
- // found the session, attempt to send the message
- session->mTextMsgQueue.push(message);
-
- // Try to send queued messages (will do nothing if the session is not open yet)
- sendQueuedTextMessages(session);
-
- // The message is queued, so we succeed.
- result = true;
- }
- else
- {
- LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL;
- }
-
- return result;
+ if (mVoiceModule) mVoiceModule->leaveChannel();
}
-void LLVoiceClient::sendQueuedTextMessages(sessionState *session)
+std::string LLVoiceClient::getCurrentChannel()
{
- if(session->mTextStreamState == 1)
+ if (mVoiceModule)
{
- if(!session->mTextMsgQueue.empty())
- {
- std::ostringstream stream;
-
- while(!session->mTextMsgQueue.empty())
- {
- std::string message = session->mTextMsgQueue.front();
- session->mTextMsgQueue.pop();
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SendMessage.1\">"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "<MessageHeader>text/HTML</MessageHeader>"
- << "<MessageBody>" << message << "</MessageBody>"
- << "</Request>"
- << "\n\n\n";
- }
- writeString(stream.str());
- }
+ return mVoiceModule->getCurrentChannel();
}
else
{
- // Session isn't connected yet, defer until later.
+ return std::string();
}
}
-void LLVoiceClient::endUserIMSession(const LLUUID &uuid)
-{
- // Figure out if a session with the user exists
- sessionState *session = findSession(uuid);
- if(session)
- {
- // found the session
- if(!session->mHandle.empty())
- {
- sessionTextDisconnectSendMessage(session);
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
- }
-}
-
-bool LLVoiceClient::answerInvite(std::string &sessionHandle)
-{
- // this is only ever used to answer incoming p2p call invites.
-
- sessionState *session = findSession(sessionHandle);
- if(session)
- {
- session->mIsSpatial = false;
- session->mReconnect = false;
- session->mIsP2P = true;
- joinSession(session);
- return true;
- }
-
- return false;
-}
+//---------------------------------------
+// invitations
-bool LLVoiceClient::isOnlineSIP(const LLUUID &id)
+void LLVoiceClient::callUser(const LLUUID &uuid)
{
- bool result = false;
- buddyListEntry *buddy = findBuddy(id);
- if(buddy)
- {
- result = buddy->mOnlineSLim;
- LL_DEBUGS("Voice") << "Buddy " << buddy->mDisplayName << " is SIP " << (result?"online":"offline") << LL_ENDL;
- }
-
- if(!result)
- {
- // This user isn't on the buddy list or doesn't show online status through the buddy list, but could be a participant in an existing session if they initiated a text IM.
- sessionState *session = findSession(id);
- if(session && !session->mHandle.empty())
- {
- if((session->mTextStreamState != streamStateUnknown) || (session->mMediaStreamState > streamStateIdle))
- {
- LL_DEBUGS("Voice") << "Open session with " << id << " found, returning SIP online state" << LL_ENDL;
- // we have a p2p text session open with this user, so by definition they're online.
- result = true;
- }
- }
- }
-
- return result;
+ if (mVoiceModule) mVoiceModule->callUser(uuid);
}
-// Returns true if the indicated participant in the current audio session is really an SL avatar.
-// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
-bool LLVoiceClient::isParticipantAvatar(const LLUUID &id)
+bool LLVoiceClient::isValidChannel(std::string &session_handle)
{
- bool result = true;
- sessionState *session = findSession(id);
-
- if(session != NULL)
+ if (mVoiceModule)
{
- // this is a p2p session with the indicated caller, or the session with the specified UUID.
- if(session->mSynthesizedCallerID)
- result = false;
+ return mVoiceModule->isValidChannel(session_handle);
}
else
{
- // Didn't find a matching session -- check the current audio session for a matching participant
- if(mAudioSession != NULL)
- {
- participantState *participant = findParticipantByID(id);
- if(participant != NULL)
- {
- result = participant->isAvatar();
- }
- }
+ return false;
}
-
- return result;
}
-// Returns true if calling back the session URI after the session has closed is possible.
-// Currently this will be false only for PSTN P2P calls.
-bool LLVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
+bool LLVoiceClient::answerInvite(std::string &channelHandle)
{
- bool result = true;
- sessionState *session = findSession(session_id);
-
- if(session != NULL)
- {
- result = session->isCallBackPossible();
- }
-
- return result;
-}
-
-// Returns true if the session can accepte text IM's.
-// Currently this will be false only for PSTN P2P calls.
-bool LLVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
-{
- bool result = true;
- sessionState *session = findSession(session_id);
-
- if(session != NULL)
+ if (mVoiceModule)
{
- result = session->isTextIMPossible();
+ return mVoiceModule->answerInvite(channelHandle);
}
-
- return result;
-}
-
-
-void LLVoiceClient::declineInvite(std::string &sessionHandle)
-{
- sessionState *session = findSession(sessionHandle);
- if(session)
- {
- sessionMediaDisconnectSendMessage(session);
- }
-}
-
-void LLVoiceClient::leaveNonSpatialChannel()
-{
- LL_DEBUGS("Voice")
- << "called in state " << state2string(getState())
- << LL_ENDL;
-
- // Make sure we don't rejoin the current session.
- sessionState *oldNextSession = mNextAudioSession;
- mNextAudioSession = NULL;
-
- // Most likely this will still be the current session at this point, but check it anyway.
- reapSession(oldNextSession);
-
- verifySessionState();
-
- sessionTerminate();
-}
-
-std::string LLVoiceClient::getCurrentChannel()
-{
- std::string result;
-
- if((getState() == stateRunning) && !mSessionTerminateRequested)
- {
- result = getAudioSessionURI();
- }
-
- return result;
-}
-
-bool LLVoiceClient::inProximalChannel()
-{
- bool result = false;
-
- if((getState() == stateRunning) && !mSessionTerminateRequested)
- {
- result = inSpatialChannel();
- }
-
- return result;
-}
-
-std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
-{
- std::string result;
- result = "sip:";
- result += nameFromID(id);
- result += "@";
- result += mVoiceSIPURIHostName;
-
- return result;
-}
-
-std::string LLVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
-{
- std::string result;
- if(avatar)
- {
- result = "sip:";
- result += nameFromID(avatar->getID());
- result += "@";
- result += mVoiceSIPURIHostName;
- }
-
- return result;
-}
-
-std::string LLVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
-{
- std::string result;
- if(avatar)
- {
- result = nameFromID(avatar->getID());
- }
- return result;
-}
-
-std::string LLVoiceClient::nameFromID(const LLUUID &uuid)
-{
- std::string result;
-
- if (uuid.isNull()) {
- //VIVOX, the uuid emtpy look for the mURIString and return that instead.
- //result.assign(uuid.mURIStringName);
- LLStringUtil::replaceChar(result, '_', ' ');
- return result;
- }
- // Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
- result = "x";
-
- // Base64 encode and replace the pieces of base64 that are less compatible
- // with e-mail local-parts.
- // See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
- result += LLBase64::encode(uuid.mData, UUID_BYTES);
- LLStringUtil::replaceChar(result, '+', '-');
- LLStringUtil::replaceChar(result, '/', '_');
-
- // If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
- // echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
-
- // The reverse transform can be done with:
- // echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
-
- return result;
-}
-
-bool LLVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
-{
- bool result = false;
-
- // SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
- // If it is, convert to a bare name before doing the transform.
- std::string name = nameFromsipURI(inName);
-
- // Doesn't look like a SIP URI, assume it's an actual name.
- if(name.empty())
- name = inName;
-
- // This will only work if the name is of the proper form.
- // As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
- // "xFnPP04IpREWNkuw1cOXlhw=="
-
- if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
- {
- // The name appears to have the right form.
-
- // Reverse the transforms done by nameFromID
- std::string temp = name;
- LLStringUtil::replaceChar(temp, '-', '+');
- LLStringUtil::replaceChar(temp, '_', '/');
-
- U8 rawuuid[UUID_BYTES + 1];
- int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
- if(len == UUID_BYTES)
- {
- // The decode succeeded. Stuff the bits into the result's UUID
- memcpy(uuid.mData, rawuuid, UUID_BYTES);
- result = true;
- }
- }
-
- if(!result)
+ else
{
- // VIVOX: not a standard account name, just copy the URI name mURIString field
- // and hope for the best. bpj
- uuid.setNull(); // VIVOX, set the uuid field to nulls
+ return false;
}
-
- return result;
}
-std::string LLVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
+void LLVoiceClient::declineInvite(std::string &channelHandle)
{
- return avatar->getFullname();
+ if (mVoiceModule) mVoiceModule->declineInvite(channelHandle);
}
-std::string LLVoiceClient::sipURIFromName(std::string &name)
-{
- std::string result;
- result = "sip:";
- result += name;
- result += "@";
- result += mVoiceSIPURIHostName;
-// LLStringUtil::toLower(result);
+//------------------------------------------
+// Volume/gain
- return result;
-}
-std::string LLVoiceClient::nameFromsipURI(const std::string &uri)
-{
- std::string result;
-
- std::string::size_type sipOffset, atOffset;
- sipOffset = uri.find("sip:");
- atOffset = uri.find("@");
- if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
- {
- result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
- }
-
- return result;
-}
-
-bool LLVoiceClient::inSpatialChannel(void)
-{
- bool result = false;
-
- if(mAudioSession)
- result = mAudioSession->mIsSpatial;
-
- return result;
-}
-
-std::string LLVoiceClient::getAudioSessionURI()
+void LLVoiceClient::setVoiceVolume(F32 volume)
{
- std::string result;
-
- if(mAudioSession)
- result = mAudioSession->mSIPURI;
-
- return result;
+ if (mVoiceModule) mVoiceModule->setVoiceVolume(volume);
}
-std::string LLVoiceClient::getAudioSessionHandle()
+void LLVoiceClient::setMicGain(F32 volume)
{
- std::string result;
-
- if(mAudioSession)
- result = mAudioSession->mHandle;
-
- return result;
+ if (mVoiceModule) mVoiceModule->setMicGain(volume);
}
-/////////////////////////////
-// Sending updates of current state
+//------------------------------------------
+// enable/disable voice features
-void LLVoiceClient::enforceTether(void)
+bool LLVoiceClient::voiceEnabled()
{
- LLVector3d tethered = mCameraRequestedPosition;
-
- // constrain 'tethered' to within 50m of mAvatarPosition.
+ if (mVoiceModule)
{
- F32 max_dist = 50.0f;
- LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
- F32 camera_distance = (F32)camera_offset.magVec();
- if(camera_distance > max_dist)
- {
- tethered = mAvatarPosition +
- (max_dist / camera_distance) * camera_offset;
- }
+ return mVoiceModule->voiceEnabled();
}
-
- if(dist_vec(mCameraPosition, tethered) > 0.1)
+ else
{
- mCameraPosition = tethered;
- mSpatialCoordsDirty = true;
+ return false;
}
}
-void LLVoiceClient::updatePosition(void)
-{
- if(gVoiceClient)
- {
- LLViewerRegion *region = gAgent.getRegion();
- if(region && isAgentAvatarValid())
- {
- LLMatrix3 rot;
- LLVector3d pos;
-
- // TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
- // They're currently always set to zero.
-
- // Send the current camera position to the voice code
- rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (), LLViewerCamera::getInstance()->getUpAxis());
- pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
-
- gVoiceClient->setCameraPosition(
- pos, // position
- LLVector3::zero, // velocity
- rot); // rotation matrix
-
- // Send the current avatar position to the voice code
- rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3();
-
- pos = gAgentAvatarp->getPositionGlobal();
- // TODO: Can we get the head offset from outside the LLVOAvatar?
-// pos += LLVector3d(mHeadOffset);
- pos += LLVector3d(0.f, 0.f, 1.f);
-
- gVoiceClient->setAvatarPosition(
- pos, // position
- LLVector3::zero, // velocity
- rot); // rotation matrix
- }
- }
-}
-
-void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+void LLVoiceClient::setVoiceEnabled(bool enabled)
{
- mCameraRequestedPosition = position;
-
- if(mCameraVelocity != velocity)
- {
- mCameraVelocity = velocity;
- mSpatialCoordsDirty = true;
- }
-
- if(mCameraRot != rot)
- {
- mCameraRot = rot;
- mSpatialCoordsDirty = true;
- }
+ if (mVoiceModule) mVoiceModule->setVoiceEnabled(enabled);
}
-void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
{
- if(dist_vec(mAvatarPosition, position) > 0.1)
- {
- mAvatarPosition = position;
- mSpatialCoordsDirty = true;
- }
-
- if(mAvatarVelocity != velocity)
- {
- mAvatarVelocity = velocity;
- mSpatialCoordsDirty = true;
- }
-
- if(mAvatarRot != rot)
- {
- mAvatarRot = rot;
- mSpatialCoordsDirty = true;
- }
+ if (mVoiceModule) mVoiceModule->setLipSyncEnabled(enabled);
}
-bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
+BOOL LLVoiceClient::lipSyncEnabled()
{
- bool result = false;
-
- if(region)
+ if (mVoiceModule)
{
- name = region->getName();
+ return mVoiceModule->lipSyncEnabled();
}
-
- if(!name.empty())
- result = true;
-
- return result;
-}
-
-void LLVoiceClient::leaveChannel(void)
-{
- if(getState() == stateRunning)
+ else
{
- LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
- mChannelName.clear();
- sessionTerminate();
+ return false;
}
}
void LLVoiceClient::setMuteMic(bool muted)
{
- mMuteMic = muted;
+ if (mVoiceModule) mVoiceModule->setMuteMic(muted);
}
-bool LLVoiceClient::getMuteMic() const
-{
- return mMuteMic;
-}
+
+// ----------------------------------------------
+// PTT
void LLVoiceClient::setUserPTTState(bool ptt)
{
- mUserPTTState = ptt;
+ if (mVoiceModule) mVoiceModule->setUserPTTState(ptt);
}
bool LLVoiceClient::getUserPTTState()
{
- return mUserPTTState;
-}
-
-void LLVoiceClient::toggleUserPTTState(void)
-{
- mUserPTTState = !mUserPTTState;
-}
-
-void LLVoiceClient::setVoiceEnabled(bool enabled)
-{
- if (enabled != mVoiceEnabled)
- {
- mVoiceEnabled = enabled;
- LLVoiceClientStatusObserver::EStatusType status;
-
- if (enabled)
- {
- LLVoiceChannel::getCurrentVoiceChannel()->activate();
- status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
- }
- else
- {
- // Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
- LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
- status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
- }
-
- notifyStatusObservers(status);
- }
-}
-
-bool LLVoiceClient::voiceEnabled()
-{
- return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
-}
-
-//AD *TODO: investigate possible merge of voiceWorking() and voiceEnabled() into one non-static method
-bool LLVoiceClient::voiceWorking()
-{
- //Added stateSessionTerminated state to avoid problems with call in parcels with disabled voice (EXT-4758)
- // Condition with joining spatial num was added to take into account possible problems with connection to voice
- // server(EXT-4313). See bug descriptions and comments for MAX_NORMAL_JOINING_SPATIAL_NUM for more info.
- return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && (stateLoggedIn <= mState) && (mState <= stateSessionTerminated);
-}
-
-void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
-{
- mLipSyncEnabled = enabled;
-}
-
-BOOL LLVoiceClient::lipSyncEnabled()
-{
-
- if ( mVoiceEnabled && stateDisabled != getState() )
+ if (mVoiceModule)
{
- return mLipSyncEnabled;
+ return mVoiceModule->getUserPTTState();
}
else
{
- return FALSE;
+ return false;
}
}
void LLVoiceClient::setUsePTT(bool usePTT)
{
- if(usePTT && !mUsePTT)
- {
- // When the user turns on PTT, reset the current state.
- mUserPTTState = false;
- }
- mUsePTT = usePTT;
+ if (mVoiceModule) mVoiceModule->setUsePTT(usePTT);
}
void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
{
- if(!PTTIsToggle && mPTTIsToggle)
- {
- // When the user turns off toggle, reset the current state.
- mUserPTTState = false;
- }
-
- mPTTIsToggle = PTTIsToggle;
+ if (mVoiceModule) mVoiceModule->setPTTIsToggle(PTTIsToggle);
}
bool LLVoiceClient::getPTTIsToggle()
{
- return mPTTIsToggle;
-}
-
-void LLVoiceClient::setPTTKey(std::string &key)
-{
- if(key == "MiddleMouse")
+ if (mVoiceModule)
{
- mPTTIsMiddleMouse = true;
+ return mVoiceModule->getPTTIsToggle();
}
- else
- {
- mPTTIsMiddleMouse = false;
- if(!LLKeyboard::keyFromString(key, &mPTTKey))
- {
- // If the call failed, don't match any key.
- key = KEY_NONE;
- }
+ else {
+ return false;
}
-}
-void LLVoiceClient::setEarLocation(S32 loc)
-{
- if(mEarLocation != loc)
- {
- LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
-
- mEarLocation = loc;
- mSpatialCoordsDirty = true;
- }
}
-void LLVoiceClient::setVoiceVolume(F32 volume)
+void LLVoiceClient::inputUserControlState(bool down)
{
- int scaled_volume = scale_speaker_volume(volume);
-
- if(scaled_volume != mSpeakerVolume)
- {
- int min_volume = scale_speaker_volume(0);
- if((scaled_volume == min_volume) || (mSpeakerVolume == min_volume))
- {
- mSpeakerMuteDirty = true;
- }
-
- mSpeakerVolume = scaled_volume;
- mSpeakerVolumeDirty = true;
- }
+ if (mVoiceModule) mVoiceModule->inputUserControlState(down);
}
-void LLVoiceClient::setMicGain(F32 volume)
+void LLVoiceClient::toggleUserPTTState(void)
{
- int scaled_volume = scale_mic_volume(volume);
-
- if(scaled_volume != mMicVolume)
- {
- mMicVolume = scaled_volume;
- mMicVolumeDirty = true;
- }
+ if (mVoiceModule) mVoiceModule->toggleUserPTTState();
}
void LLVoiceClient::keyDown(KEY key, MASK mask)
{
- if (gKeyboard->getKeyRepeated(key))
- {
- // ignore auto-repeat keys
- return;
- }
-
- if(!mPTTIsMiddleMouse)
- {
- bool down = (mPTTKey != KEY_NONE)
- && gKeyboard->getKeyDown(mPTTKey);
- inputUserControlState(down);
- }
+ if (mVoiceModule) mVoiceModule->keyDown(key, mask);
}
void LLVoiceClient::keyUp(KEY key, MASK mask)
{
- if(!mPTTIsMiddleMouse)
- {
- bool down = (mPTTKey != KEY_NONE)
- && gKeyboard->getKeyDown(mPTTKey);
- inputUserControlState(down);
- }
-}
-void LLVoiceClient::inputUserControlState(bool down)
-{
- if(mPTTIsToggle)
- {
- if(down) // toggle open-mic state on 'down'
- {
- toggleUserPTTState();
- }
- }
- else // set open-mic state as an absolute
- {
- setUserPTTState(down);
- }
+ if (mVoiceModule) mVoiceModule->keyUp(key, mask);
}
void LLVoiceClient::middleMouseState(bool down)
{
- if(mPTTIsMiddleMouse)
- {
- inputUserControlState(down);
- }
+ if (mVoiceModule) mVoiceModule->middleMouseState(down);
}
-/////////////////////////////
-// Accessors for data related to nearby speakers
+
+//-------------------------------------------
+// nearby speaker accessors
+
BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
{
- BOOL result = FALSE;
- participantState *participant = findParticipantByID(id);
- if(participant)
+ if (mVoiceModule)
{
- // I'm not sure what the semantics of this should be.
- // For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
- result = TRUE;
- }
-
- return result;
-}
-
-BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
-{
- BOOL result = FALSE;
-
- participantState *participant = findParticipantByID(id);
- if(participant)
+ return mVoiceModule->getVoiceEnabled(id);
+ }
+ else
{
- if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
- {
- participant->mIsSpeaking = FALSE;
- }
- result = participant->mIsSpeaking;
+ return FALSE;
}
-
- return result;
}
-BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
+std::string LLVoiceClient::getDisplayName(const LLUUID& id)
{
- BOOL result = FALSE;
-
- participantState *participant = findParticipantByID(id);
- if(participant)
+ if (mVoiceModule)
{
- result = participant->mIsModeratorMuted;
+ return mVoiceModule->getDisplayName(id);
}
-
- return result;
-}
-
-F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
-{
- F32 result = 0;
- participantState *participant = findParticipantByID(id);
- if(participant)
+ else
{
- result = participant->mPower;
+ return std::string();
}
-
- return result;
}
-
-std::string LLVoiceClient::getDisplayName(const LLUUID& id)
+bool LLVoiceClient::isVoiceWorking()
{
- std::string result;
- participantState *participant = findParticipantByID(id);
- if(participant)
+ if (mVoiceModule)
{
- result = participant->mDisplayName;
+ return mVoiceModule->isVoiceWorking();
}
-
- return result;
+ return false;
}
-
-BOOL LLVoiceClient::getUsingPTT(const LLUUID& id)
+BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id)
{
- BOOL result = FALSE;
-
- participantState *participant = findParticipantByID(id);
- if(participant)
+ if (mVoiceModule)
{
- // I'm not sure what the semantics of this should be.
- // Does "using PTT" mean they're configured with a push-to-talk button?
- // For now, we know there's no PTT mechanism in place, so nobody is using it.
+ return mVoiceModule->isParticipantAvatar(id);
}
-
- return result;
-}
-
-BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
-{
- BOOL result = FALSE;
-
- participantState *participant = findParticipantByID(id);
- if(participant)
+ else
{
- result = participant->mOnMuteList;
+ return FALSE;
}
-
- return result;
}
-// External accessors.
-F32 LLVoiceClient::getUserVolume(const LLUUID& id)
+BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id)
{
- // Minimum volume will be returned for users with voice disabled
- F32 result = VOLUME_MIN;
-
- participantState *participant = findParticipantByID(id);
- if(participant)
+ if (mVoiceModule)
{
- result = participant->mVolume;
-
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "mVolume = " << result << " for " << id << LL_ENDL;
+ return mVoiceModule->isOnlineSIP(id);
}
-
- return result;
-}
-
-void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
-{
- if(mAudioSession)
+ else
{
- participantState *participant = findParticipantByID(id);
- if (participant && !participant->mIsSelf)
- {
- if (!is_approx_equal(volume, VOLUME_DEFAULT))
- {
- // Store this volume setting for future sessions if it has been
- // changed from the default
- LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
- }
- else
- {
- // Remove stored volume setting if it is returned to the default
- LLSpeakerVolumeStorage::getInstance()->removeSpeakerVolume(id);
- }
-
- participant->mVolume = llclamp(volume, VOLUME_MIN, VOLUME_MAX);
- participant->mVolumeDirty = true;
- mAudioSession->mVolumeDirty = true;
- }
+ return FALSE;
}
}
-std::string LLVoiceClient::getGroupID(const LLUUID& id)
+BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
{
- std::string result;
-
- participantState *participant = findParticipantByID(id);
- if(participant)
+ if (mVoiceModule)
{
- result = participant->mGroupID;
+ return mVoiceModule->getIsSpeaking(id);
}
-
- return result;
-}
-
-BOOL LLVoiceClient::getAreaVoiceDisabled()
-{
- return mAreaVoiceDisabled;
-}
-
-void LLVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
-{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
-
- if(!mMainSessionGroupHandle.empty())
+ else
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Start</RecordingControlType>"
- << "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
- << "<Filename>" << "" << "</Filename>"
- << "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
- << "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
- << "</Request>\n\n\n";
-
-
- writeString(stream.str());
+ return FALSE;
}
}
-void LLVoiceClient::recordingLoopSave(const std::string& filename)
+BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
-
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ if (mVoiceModule)
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Flush</RecordingControlType>"
- << "<Filename>" << filename << "</Filename>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ return mVoiceModule->getIsModeratorMuted(id);
}
-}
-
-void LLVoiceClient::recordingStop()
-{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
-
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ else
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Stop</RecordingControlType>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ return FALSE;
}
}
-void LLVoiceClient::filePlaybackStart(const std::string& filename)
-{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
-
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
+{
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getCurrentPower(id);
+ }
+ else
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Start</RecordingControlType>"
- << "<Filename>" << filename << "</Filename>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ return 0.0;
}
}
-void LLVoiceClient::filePlaybackStop()
+BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
-
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ if (mVoiceModule)
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Stop</RecordingControlType>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ return mVoiceModule->getOnMuteList(id);
+ }
+ else
+ {
+ return FALSE;
}
}
-void LLVoiceClient::filePlaybackSetPaused(bool paused)
+F32 LLVoiceClient::getUserVolume(const LLUUID& id)
{
- // TODO: Implement once Vivox gives me a sample
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getUserVolume(id);
+ }
+ else
+ {
+ return 0.0;
+ }
}
-void LLVoiceClient::filePlaybackSetMode(bool vox, float speed)
+void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
{
- // TODO: Implement once Vivox gives me a sample
+ if (mVoiceModule) mVoiceModule->setUserVolume(id, volume);
}
-LLVoiceClient::sessionState::sessionState() :
- mErrorStatusCode(0),
- mMediaStreamState(streamStateUnknown),
- mTextStreamState(streamStateUnknown),
- mCreateInProgress(false),
- mMediaConnectInProgress(false),
- mVoiceInvitePending(false),
- mTextInvitePending(false),
- mSynthesizedCallerID(false),
- mIsChannel(false),
- mIsSpatial(false),
- mIsP2P(false),
- mIncoming(false),
- mVoiceEnabled(false),
- mReconnect(false),
- mVolumeDirty(false),
- mMuteDirty(false),
- mParticipantsChanged(false)
-{
-}
+//--------------------------------------------------
+// status observers
-LLVoiceClient::sessionState::~sessionState()
+void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
{
- removeAllParticipants();
+ if (mVoiceModule) mVoiceModule->addObserver(observer);
}
-bool LLVoiceClient::sessionState::isCallBackPossible()
+void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
{
- // This may change to be explicitly specified by vivox in the future...
- // Currently, only PSTN P2P calls cannot be returned.
- // Conveniently, this is also the only case where we synthesize a caller UUID.
- return !mSynthesizedCallerID;
+ if (mVoiceModule) mVoiceModule->removeObserver(observer);
}
-bool LLVoiceClient::sessionState::isTextIMPossible()
+void LLVoiceClient::addObserver(LLFriendObserver* observer)
{
- // This may change to be explicitly specified by vivox in the future...
- return !mSynthesizedCallerID;
+ if (mVoiceModule) mVoiceModule->addObserver(observer);
}
-
-LLVoiceClient::sessionIterator LLVoiceClient::sessionsBegin(void)
+void LLVoiceClient::removeObserver(LLFriendObserver* observer)
{
- return mSessions.begin();
+ if (mVoiceModule) mVoiceModule->removeObserver(observer);
}
-LLVoiceClient::sessionIterator LLVoiceClient::sessionsEnd(void)
+void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
{
- return mSessions.end();
+ if (mVoiceModule) mVoiceModule->addObserver(observer);
}
-
-LLVoiceClient::sessionState *LLVoiceClient::findSession(const std::string &handle)
-{
- sessionState *result = NULL;
- sessionMap::iterator iter = mSessionsByHandle.find(&handle);
- if(iter != mSessionsByHandle.end())
- {
- result = iter->second;
- }
-
- return result;
-}
-
-LLVoiceClient::sessionState *LLVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
-{
- sessionState *result = NULL;
- for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
- {
- sessionState *session = *iter;
- if(session->mCreateInProgress && (session->mSIPURI == uri))
- {
- result = session;
- break;
- }
- }
-
- return result;
-}
-
-LLVoiceClient::sessionState *LLVoiceClient::findSession(const LLUUID &participant_id)
+void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
{
- sessionState *result = NULL;
-
- for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
- {
- sessionState *session = *iter;
- if((session->mCallerID == participant_id) || (session->mIMSessionID == participant_id))
- {
- result = session;
- break;
- }
- }
-
- return result;
+ if (mVoiceModule) mVoiceModule->removeObserver(observer);
}
-LLVoiceClient::sessionState *LLVoiceClient::addSession(const std::string &uri, const std::string &handle)
+std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
{
- sessionState *result = NULL;
-
- if(handle.empty())
+ if (mVoiceModule)
{
- // No handle supplied.
- // Check whether there's already a session with this URI
- for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
- {
- sessionState *s = *iter;
- if((s->mSIPURI == uri) || (s->mAlternateSIPURI == uri))
- {
- // TODO: I need to think about this logic... it's possible that this case should raise an internal error.
- result = s;
- break;
- }
- }
- }
- else // (!handle.empty())
- {
- // Check for an existing session with this handle
- sessionMap::iterator iter = mSessionsByHandle.find(&handle);
-
- if(iter != mSessionsByHandle.end())
- {
- result = iter->second;
- }
- }
-
- if(!result)
- {
- // No existing session found.
-
- LL_DEBUGS("Voice") << "adding new session: handle " << handle << " URI " << uri << LL_ENDL;
- result = new sessionState();
- result->mSIPURI = uri;
- result->mHandle = handle;
-
- mSessions.insert(result);
-
- if(!result->mHandle.empty())
- {
- mSessionsByHandle.insert(sessionMap::value_type(&(result->mHandle), result));
- }
+ return mVoiceModule->sipURIFromID(id);
}
else
{
- // Found an existing session
-
- if(uri != result->mSIPURI)
- {
- // TODO: Should this be an internal error?
- LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
- setSessionURI(result, uri);
- }
-
- if(handle != result->mHandle)
- {
- if(handle.empty())
- {
- // There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
- LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
- }
- else
- {
- // TODO: Should this be an internal error?
- LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
- setSessionHandle(result, handle);
- }
- }
-
- LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
- }
-
- verifySessionState();
-
- return result;
-}
-
-void LLVoiceClient::setSessionHandle(sessionState *session, const std::string &handle)
-{
- // Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
-
- if(!session->mHandle.empty())
- {
- // Remove session from the map if it should have been there.
- sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
- if(iter != mSessionsByHandle.end())
- {
- if(iter->second != session)
- {
- LL_ERRS("Voice") << "Internal error: session mismatch!" << LL_ENDL;
- }
-
- mSessionsByHandle.erase(iter);
- }
- else
- {
- LL_ERRS("Voice") << "Internal error: session handle not found in map!" << LL_ENDL;
- }
+ return std::string();
}
-
- session->mHandle = handle;
-
- if(!handle.empty())
- {
- mSessionsByHandle.insert(sessionMap::value_type(&(session->mHandle), session));
- }
-
- verifySessionState();
}
-void LLVoiceClient::setSessionURI(sessionState *session, const std::string &uri)
-{
- // There used to be a map of session URIs to sessions, which made this complex....
- session->mSIPURI = uri;
- verifySessionState();
-}
+///////////////////
+// version checking
-void LLVoiceClient::deleteSession(sessionState *session)
+class LLViewerRequiredVoiceVersion : public LLHTTPNode
{
- // Remove the session from the handle map
- if(!session->mHandle.empty())
+ static BOOL sAlertedUser;
+ virtual void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
{
- sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
- if(iter != mSessionsByHandle.end())
+ //You received this messsage (most likely on region cross or
+ //teleport)
+ if ( input.has("body") && input["body"].has("major_version") )
{
- if(iter->second != session)
+ int major_voice_version =
+ input["body"]["major_version"].asInteger();
+ // int minor_voice_version =
+ // input["body"]["minor_version"].asInteger();
+ LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion();
+
+ if (major_voice_version > 1)
{
- LL_ERRS("Voice") << "Internal error: session mismatch" << LL_ENDL;
+ if (!sAlertedUser)
+ {
+ //sAlertedUser = TRUE;
+ LLNotificationsUtil::add("VoiceVersionMismatch");
+ gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
+ }
}
- mSessionsByHandle.erase(iter);
}
}
+};
- // Remove the session from the URI map
- mSessions.erase(session);
-
- // At this point, the session should be unhooked from all lists and all state should be consistent.
- verifySessionState();
-
- // If this is the current audio session, clean up the pointer which will soon be dangling.
- if(mAudioSession == session)
- {
- mAudioSession = NULL;
- mAudioSessionChanged = true;
- }
-
- // ditto for the next audio session
- if(mNextAudioSession == session)
- {
- mNextAudioSession = NULL;
- }
-
- // delete the session
- delete session;
-}
-
-void LLVoiceClient::deleteAllSessions()
-{
- LL_DEBUGS("Voice") << "called" << LL_ENDL;
-
- while(!mSessions.empty())
- {
- deleteSession(*(sessionsBegin()));
- }
-
- if(!mSessionsByHandle.empty())
- {
- LL_ERRS("Voice") << "Internal error: empty session map, non-empty handle map" << LL_ENDL;
- }
-}
-
-void LLVoiceClient::verifySessionState(void)
+class LLViewerParcelVoiceInfo : public LLHTTPNode
{
- // This is mostly intended for debugging problems with session state management.
- LL_DEBUGS("Voice") << "Total session count: " << mSessions.size() << " , session handle map size: " << mSessionsByHandle.size() << LL_ENDL;
-
- for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+ virtual void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
{
- sessionState *session = *iter;
-
- LL_DEBUGS("Voice") << "session " << session << ": handle " << session->mHandle << ", URI " << session->mSIPURI << LL_ENDL;
+ //the parcel you are in has changed something about its
+ //voice information
- if(!session->mHandle.empty())
+ //this is a misnomer, as it can also be when you are not in
+ //a parcel at all. Should really be something like
+ //LLViewerVoiceInfoChanged.....
+ if ( input.has("body") )
{
- // every session with a non-empty handle needs to be in the handle map
- sessionMap::iterator i2 = mSessionsByHandle.find(&(session->mHandle));
- if(i2 == mSessionsByHandle.end())
- {
- LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " not found in session map)" << LL_ENDL;
- }
- else
+ LLSD body = input["body"];
+
+ //body has "region_name" (str), "parcel_local_id"(int),
+ //"voice_credentials" (map).
+
+ //body["voice_credentials"] has "channel_uri" (str),
+ //body["voice_credentials"] has "channel_credentials" (str)
+
+ //if we really wanted to be extra careful,
+ //we'd check the supplied
+ //local parcel id to make sure it's for the same parcel
+ //we believe we're in
+ if ( body.has("voice_credentials") )
{
- if(i2->second != session)
+ LLSD voice_credentials = body["voice_credentials"];
+ std::string uri;
+ std::string credentials;
+
+ if ( voice_credentials.has("channel_uri") )
{
- LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " in session map points to another session)" << LL_ENDL;
+ uri = voice_credentials["channel_uri"].asString();
}
+ if ( voice_credentials.has("channel_credentials") )
+ {
+ credentials =
+ voice_credentials["channel_credentials"].asString();
+ }
+
+ LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
}
}
}
-
- // check that every entry in the handle map points to a valid session in the session set
- for(sessionMap::iterator iter = mSessionsByHandle.begin(); iter != mSessionsByHandle.end(); iter++)
- {
- sessionState *session = iter->second;
- sessionIterator i2 = mSessions.find(session);
- if(i2 == mSessions.end())
- {
- LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " not found in session map)" << LL_ENDL;
- }
- else
- {
- if(session->mHandle != (*i2)->mHandle)
- {
- LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " points to session with different handle " << (*i2)->mHandle << ")" << LL_ENDL;
- }
- }
- }
-}
+};
-LLVoiceClient::buddyListEntry::buddyListEntry(const std::string &uri) :
- mURI(uri)
-{
- mOnlineSL = false;
- mOnlineSLim = false;
- mCanSeeMeOnline = true;
- mHasBlockListEntry = false;
- mHasAutoAcceptListEntry = false;
- mNameResolved = false;
- mInVivoxBuddies = false;
- mInSLFriends = false;
- mNeedsNameUpdate = false;
-}
+const std::string LLSpeakerVolumeStorage::SETTINGS_FILE_NAME = "volume_settings.xml";
-void LLVoiceClient::processBuddyListEntry(const std::string &uri, const std::string &displayName)
+LLSpeakerVolumeStorage::LLSpeakerVolumeStorage()
{
- buddyListEntry *buddy = addBuddy(uri, displayName);
- buddy->mInVivoxBuddies = true;
+ load();
}
-LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri)
+LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
{
- std::string empty;
- buddyListEntry *buddy = addBuddy(uri, empty);
- if(buddy->mDisplayName.empty())
- {
- buddy->mNameResolved = false;
- }
- return buddy;
+ save();
}
-LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri, const std::string &displayName)
+void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
{
- buddyListEntry *result = NULL;
- buddyListMap::iterator iter = mBuddyListMap.find(&uri);
-
- if(iter != mBuddyListMap.end())
- {
- // Found a matching buddy already in the map.
- LL_DEBUGS("Voice") << "adding existing buddy " << uri << LL_ENDL;
- result = iter->second;
- }
-
- if(!result)
+ if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
{
- // participant isn't already in one list or the other.
- LL_DEBUGS("Voice") << "adding new buddy " << uri << LL_ENDL;
- result = new buddyListEntry(uri);
- result->mDisplayName = displayName;
-
- if(IDFromName(uri, result->mUUID))
- {
- // Extracted UUID from name successfully.
- }
- else
- {
- LL_DEBUGS("Voice") << "Couldn't find ID for buddy " << uri << " (\"" << displayName << "\")" << LL_ENDL;
- }
-
- mBuddyListMap.insert(buddyListMap::value_type(&(result->mURI), result));
- }
-
- return result;
-}
+ mSpeakersData[speaker_id] = volume;
-LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const std::string &uri)
-{
- buddyListEntry *result = NULL;
- buddyListMap::iterator iter = mBuddyListMap.find(&uri);
- if(iter != mBuddyListMap.end())
- {
- result = iter->second;
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "Stored volume = " << volume << " for " << id << LL_ENDL;
}
-
- return result;
-}
-
-LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const LLUUID &id)
-{
- buddyListEntry *result = NULL;
- buddyListMap::iterator iter;
-
- for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
+ else
{
- if(iter->second->mUUID == id)
- {
- result = iter->second;
- break;
- }
+ LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
+ llassert(0);
}
-
- return result;
}
-LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddyByDisplayName(const std::string &name)
+bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume)
{
- buddyListEntry *result = NULL;
- buddyListMap::iterator iter;
-
- for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
- {
- if(iter->second->mDisplayName == name)
- {
- result = iter->second;
- break;
- }
- }
+ speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
- return result;
-}
-
-void LLVoiceClient::deleteBuddy(const std::string &uri)
-{
- buddyListMap::iterator iter = mBuddyListMap.find(&uri);
- if(iter != mBuddyListMap.end())
- {
- LL_DEBUGS("Voice") << "deleting buddy " << uri << LL_ENDL;
- buddyListEntry *buddy = iter->second;
- mBuddyListMap.erase(iter);
- delete buddy;
- }
- else
+ if (it != mSpeakersData.end())
{
- LL_DEBUGS("Voice") << "attempt to delete nonexistent buddy " << uri << LL_ENDL;
- }
-
-}
+ volume = it->second;
-void LLVoiceClient::deleteAllBuddies(void)
-{
- while(!mBuddyListMap.empty())
- {
- deleteBuddy(*(mBuddyListMap.begin()->first));
- }
-
- // Don't want to correlate with friends list when we've emptied the buddy list.
- mBuddyListMapPopulated = false;
-
- // Don't want to correlate with friends list when we've reset the block rules.
- mBlockRulesListReceived = false;
- mAutoAcceptRulesListReceived = false;
-}
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume << " for " << id << LL_ENDL;
-void LLVoiceClient::deleteAllBlockRules(void)
-{
- // Clear the block list entry flags from all local buddy list entries
- buddyListMap::iterator buddy_it;
- for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
- {
- buddy_it->second->mHasBlockListEntry = false;
+ return true;
}
-}
-void LLVoiceClient::deleteAllAutoAcceptRules(void)
-{
- // Clear the auto-accept list entry flags from all local buddy list entries
- buddyListMap::iterator buddy_it;
- for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
- {
- buddy_it->second->mHasAutoAcceptListEntry = false;
- }
+ return false;
}
-void LLVoiceClient::addBlockRule(const std::string &blockMask, const std::string &presenceOnly)
+void LLSpeakerVolumeStorage::removeSpeakerVolume(const LLUUID& speaker_id)
{
- buddyListEntry *buddy = NULL;
-
- // blockMask is the SIP URI of a friends list entry
- buddyListMap::iterator iter = mBuddyListMap.find(&blockMask);
- if(iter != mBuddyListMap.end())
- {
- LL_DEBUGS("Voice") << "block list entry for " << blockMask << LL_ENDL;
- buddy = iter->second;
- }
+ mSpeakersData.erase(speaker_id);
- if(buddy == NULL)
- {
- LL_DEBUGS("Voice") << "block list entry for unknown buddy " << blockMask << LL_ENDL;
- buddy = addBuddy(blockMask);
- }
-
- if(buddy != NULL)
- {
- buddy->mHasBlockListEntry = true;
- }
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "Removing stored volume for " << id << LL_ENDL;
}
-void LLVoiceClient::addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy)
+/* static */ F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in)
{
- buddyListEntry *buddy = NULL;
+ // Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+ // from legacy characteristic composed of two square-curves
+ // that intersect at volume_in = 0.5, volume_out = 0.56
- // blockMask is the SIP URI of a friends list entry
- buddyListMap::iterator iter = mBuddyListMap.find(&autoAcceptMask);
- if(iter != mBuddyListMap.end())
- {
- LL_DEBUGS("Voice") << "auto-accept list entry for " << autoAcceptMask << LL_ENDL;
- buddy = iter->second;
- }
+ F32 volume_out = 0.f;
+ volume_in = llclamp(volume_in, 0.f, 1.0f);
- if(buddy == NULL)
+ if (volume_in <= 0.5f)
{
- LL_DEBUGS("Voice") << "auto-accept list entry for unknown buddy " << autoAcceptMask << LL_ENDL;
- buddy = addBuddy(autoAcceptMask);
+ volume_out = volume_in * volume_in * 4.f * 0.56f;
}
-
- if(buddy != NULL)
+ else
{
- buddy->mHasAutoAcceptListEntry = true;
+ volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
}
-}
-
-void LLVoiceClient::accountListBlockRulesResponse(int statusCode, const std::string &statusString)
-{
- // Block list entries were updated via addBlockRule() during parsing. Just flag that we're done.
- mBlockRulesListReceived = true;
-}
-
-void LLVoiceClient::accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString)
-{
- // Block list entries were updated via addBlockRule() during parsing. Just flag that we're done.
- mAutoAcceptRulesListReceived = true;
-}
-void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
-{
- mParticipantObservers.insert(observer);
-}
-
-void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
-{
- mParticipantObservers.erase(observer);
-}
-
-void LLVoiceClient::notifyParticipantObservers()
-{
- for (observer_set_t::iterator it = mParticipantObservers.begin();
- it != mParticipantObservers.end();
- )
- {
- LLVoiceClientParticipantObserver* observer = *it;
- observer->onChange();
- // In case onChange() deleted an entry.
- it = mParticipantObservers.upper_bound(observer);
- }
+ return volume_out;
}
-void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
+/* static */ F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in)
{
- mStatusObservers.insert(observer);
-}
+ // Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+ // to legacy characteristic composed of two square-curves
+ // that intersect at volume_in = 0.56, volume_out = 0.5
-void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
-{
- mStatusObservers.erase(observer);
-}
+ F32 volume_out = 0.f;
+ volume_in = llclamp(volume_in, 0.f, 1.0f);
-void LLVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
-{
- if(mAudioSession)
+ if (volume_in <= 0.56f)
{
- if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
- {
- switch(mAudioSession->mErrorStatusCode)
- {
- case 20713: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; break;
- case 20714: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; break;
- case 20715:
- //invalid channel, we may be using a set of poorly cached
- //info
- status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
- break;
- case 1009:
- //invalid username and password
- status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
- break;
- }
-
- // Reset the error code to make sure it won't be reused later by accident.
- mAudioSession->mErrorStatusCode = 0;
- }
- else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
- {
- switch(mAudioSession->mErrorStatusCode)
- {
- case 404: // NOT_FOUND
- case 480: // TEMPORARILY_UNAVAILABLE
- case 408: // REQUEST_TIMEOUT
- // call failed because other user was not available
- // treat this as an error case
- status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-
- // Reset the error code to make sure it won't be reused later by accident.
- mAudioSession->mErrorStatusCode = 0;
- break;
- }
- }
+ volume_out = sqrt(volume_in / (4.f * 0.56f));
}
-
- LL_DEBUGS("Voice")
- << " " << LLVoiceClientStatusObserver::status2string(status)
- << ", session URI " << getAudioSessionURI()
- << (inSpatialChannel()?", proximal is true":", proximal is false")
- << LL_ENDL;
-
- for (status_observer_set_t::iterator it = mStatusObservers.begin();
- it != mStatusObservers.end();
- )
+ else
{
- LLVoiceClientStatusObserver* observer = *it;
- observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
- // In case onError() deleted an entry.
- it = mStatusObservers.upper_bound(observer);
+ volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
}
+ return volume_out;
}
-void LLVoiceClient::addObserver(LLFriendObserver* observer)
-{
- mFriendObservers.insert(observer);
-}
-
-void LLVoiceClient::removeObserver(LLFriendObserver* observer)
-{
- mFriendObservers.erase(observer);
-}
-
-void LLVoiceClient::notifyFriendObservers()
+void LLSpeakerVolumeStorage::load()
{
- for (friend_observer_set_t::iterator it = mFriendObservers.begin();
- it != mFriendObservers.end();
- )
- {
- LLFriendObserver* observer = *it;
- it++;
- // The only friend-related thing we notify on is online/offline transitions.
- observer->changed(LLFriendObserver::ONLINE);
- }
-}
+ // load per-resident voice volume information
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
-void LLVoiceClient::lookupName(const LLUUID &id)
-{
- BOOL is_group = FALSE;
- gCacheName->get(id, is_group, &LLVoiceClient::onAvatarNameLookup);
-}
+ LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
-//static
-void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
-{
- if(gVoiceClient)
+ LLSD settings_llsd;
+ llifstream file;
+ file.open(filename);
+ if (file.is_open())
{
- std::string name = llformat("%s %s", first.c_str(), last.c_str());
- gVoiceClient->avatarNameResolved(id, name);
+ LLSDSerialize::fromXML(settings_llsd, file);
}
-}
-void LLVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
-{
- // If the avatar whose name just resolved is on our friends list, resync the friends list.
- if(LLAvatarTracker::instance().getBuddyInfo(id) != NULL)
- {
- mFriendsListDirty = true;
- }
-
- // Iterate over all sessions.
- for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+ for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
+ iter != settings_llsd.endMap(); ++iter)
{
- sessionState *session = *iter;
-
- // Check for this user as a participant in this session
- participantState *participant = session->findParticipantByID(id);
- if(participant)
- {
- // Found -- fill in the name
- participant->mAccountName = name;
- // and post a "participants updated" message to listeners later.
- session->mParticipantsChanged = true;
- }
-
- // Check whether this is a p2p session whose caller name just resolved
- if(session->mCallerID == id)
- {
- // this session's "caller ID" just resolved. Fill in the name.
- session->mName = name;
- if(session->mTextInvitePending)
- {
- session->mTextInvitePending = false;
+ // Maintain compatibility with 1.23 non-linear saved volume levels
+ F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
- // We don't need to call gIMMgr->addP2PSession() here. The first incoming message will create the panel.
- }
- if(session->mVoiceInvitePending)
- {
- session->mVoiceInvitePending = false;
-
- gIMMgr->inviteToSession(
- session->mIMSessionID,
- session->mName,
- session->mCallerID,
- session->mName,
- IM_SESSION_P2P_INVITE,
- LLIMMgr::INVITATION_TYPE_VOICE,
- session->mHandle,
- session->mSIPURI);
- }
-
- }
+ storeSpeakerVolume(LLUUID(iter->first), volume);
}
}
-class LLViewerParcelVoiceInfo : public LLHTTPNode
+void LLSpeakerVolumeStorage::save()
{
- virtual void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
+ // If we quit from the login screen we will not have an SL account
+ // name. Don't try to save, otherwise we'll dump a file in
+ // C:\Program Files\SecondLife\ or similar. JC
+ std::string user_dir = gDirUtilp->getLindenUserDir();
+ if (!user_dir.empty())
{
- //the parcel you are in has changed something about its
- //voice information
-
- //this is a misnomer, as it can also be when you are not in
- //a parcel at all. Should really be something like
- //LLViewerVoiceInfoChanged.....
- if ( input.has("body") )
- {
- LLSD body = input["body"];
-
- //body has "region_name" (str), "parcel_local_id"(int),
- //"voice_credentials" (map).
-
- //body["voice_credentials"] has "channel_uri" (str),
- //body["voice_credentials"] has "channel_credentials" (str)
-
- //if we really wanted to be extra careful,
- //we'd check the supplied
- //local parcel id to make sure it's for the same parcel
- //we believe we're in
- if ( body.has("voice_credentials") )
- {
- LLSD voice_credentials = body["voice_credentials"];
- std::string uri;
- std::string credentials;
-
- if ( voice_credentials.has("channel_uri") )
- {
- uri = voice_credentials["channel_uri"].asString();
- }
- if ( voice_credentials.has("channel_credentials") )
- {
- credentials =
- voice_credentials["channel_credentials"].asString();
- }
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
+ LLSD settings_llsd;
- gVoiceClient->setSpatialChannel(uri, credentials);
- }
- }
- }
-};
+ LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
-class LLViewerRequiredVoiceVersion : public LLHTTPNode
-{
- static BOOL sAlertedUser;
- virtual void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- //You received this messsage (most likely on region cross or
- //teleport)
- if ( input.has("body") && input["body"].has("major_version") )
+ for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
{
- int major_voice_version =
- input["body"]["major_version"].asInteger();
-// int minor_voice_version =
-// input["body"]["minor_version"].asInteger();
+ // Maintain compatibility with 1.23 non-linear saved volume levels
+ F32 volume = transformToLegacyVolume(iter->second);
- if (gVoiceClient &&
- (major_voice_version > VOICE_MAJOR_VERSION) )
- {
- if (!sAlertedUser)
- {
- //sAlertedUser = TRUE;
- LLNotificationsUtil::add("VoiceVersionMismatch");
- gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
- }
- }
+ settings_llsd[iter->first.asString()] = volume;
}
+
+ llofstream file;
+ file.open(filename);
+ LLSDSerialize::toPrettyXML(settings_llsd, file);
}
-};
+}
+
BOOL LLViewerRequiredVoiceVersion::sAlertedUser = FALSE;
LLHTTPRegistration<LLViewerParcelVoiceInfo>
- gHTTPRegistrationMessageParcelVoiceInfo(
- "/message/ParcelVoiceInfo");
+gHTTPRegistrationMessageParcelVoiceInfo(
+ "/message/ParcelVoiceInfo");
LLHTTPRegistration<LLViewerRequiredVoiceVersion>
- gHTTPRegistrationMessageRequiredVoiceVersion(
- "/message/RequiredVoiceVersion");
+gHTTPRegistrationMessageRequiredVoiceVersion(
+ "/message/RequiredVoiceVersion");
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index a29c386182..e08fed7ae9 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -17,8 +17,7 @@
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -33,7 +32,6 @@
#define LL_VOICE_CLIENT_H
class LLVOAvatar;
-class LLVivoxProtocolParser;
#include "lliopipe.h"
#include "llpumpio.h"
@@ -42,9 +40,14 @@ class LLVivoxProtocolParser;
#include "v3math.h"
#include "llframetimer.h"
#include "llviewerregion.h"
-#include "m3math.h" // LLMatrix3
+#include "llcallingcard.h" // for LLFriendObserver
+#include "llsecapi.h"
+
+// devices
+
+typedef std::vector<std::string> LLVoiceDeviceList;
+
-class LLFriendObserver;
class LLVoiceClientParticipantObserver
{
public:
@@ -52,6 +55,9 @@ public:
virtual void onChange() = 0;
};
+
+///////////////////////////////////
+/// @class LLVoiceClientStatusObserver
class LLVoiceClientStatusObserver
{
public:
@@ -65,11 +71,7 @@ public:
STATUS_JOINED,
STATUS_LEFT_CHANNEL,
STATUS_VOICE_DISABLED,
-
- // Adding STATUS_VOICE_ENABLED as pair status for STATUS_VOICE_DISABLED
- // See LLVoiceClient::setVoiceEnabled()
STATUS_VOICE_ENABLED,
-
BEGIN_ERROR_STATUS,
ERROR_CHANNEL_FULL,
ERROR_CHANNEL_LOCKED,
@@ -83,699 +85,379 @@ public:
static std::string status2string(EStatusType inStatus);
};
-class LLVoiceClient: public LLSingleton<LLVoiceClient>
+struct LLVoiceVersionInfo
{
- LOG_CLASS(LLVoiceClient);
- public:
- LLVoiceClient();
- ~LLVoiceClient();
-
- public:
- static void init(LLPumpIO *pump); // Call this once at application startup (creates connector)
- static void terminate(); // Call this to clean up during shutdown
-
- protected:
- bool writeString(const std::string &str);
-
- public:
-
- static F32 OVERDRIVEN_POWER_LEVEL;
+ std::string serverType;
+ std::string serverVersion;
+};
- static const F32 VOLUME_MIN;
- static const F32 VOLUME_DEFAULT;
- static const F32 VOLUME_MAX;
+//////////////////////////////////
+/// @class LLVoiceModuleInterface
+/// @brief Voice module interface
+///
+/// Voice modules should provide an implementation for this interface.
+/////////////////////////////////
- void updateSettings(); // call after loading settings and whenever they change
+class LLVoiceModuleInterface
+{
+public:
+ LLVoiceModuleInterface() {}
+ virtual ~LLVoiceModuleInterface() {}
- void getCaptureDevicesSendMessage();
- void getRenderDevicesSendMessage();
-
- void clearCaptureDevices();
- void addCaptureDevice(const std::string& name);
- void setCaptureDevice(const std::string& name);
-
- void clearRenderDevices();
- void addRenderDevice(const std::string& name);
- void setRenderDevice(const std::string& name);
-
- void tuningStart();
- void tuningStop();
- bool inTuningMode();
- bool inTuningStates();
-
- void tuningRenderStartSendMessage(const std::string& name, bool loop);
- void tuningRenderStopSendMessage();
-
- void tuningCaptureStartSendMessage(int duration);
- void tuningCaptureStopSendMessage();
-
- void tuningSetMicVolume(float volume);
- void tuningSetSpeakerVolume(float volume);
- float tuningGetEnergy(void);
-
- // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
- // i.e. when the daemon is running and connected, and the device lists are populated.
- bool deviceSettingsAvailable();
-
- // Requery the vivox daemon for the current list of input/output devices.
- // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
- // (use this if you want to know when it's done).
- // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
- void refreshDeviceLists(bool clearCurrentList = true);
-
- // Call this if the connection to the daemon terminates unexpectedly. It will attempt to reset everything and relaunch.
- void daemonDied();
-
- // Call this if we're just giving up on voice (can't provision an account, etc.). It will clean up and go away.
- void giveUp();
-
- /////////////////////////////
- // Response/Event handlers
- void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
- void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
- void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
- void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
- void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
- void logoutResponse(int statusCode, std::string &statusString);
- void connectorShutdownResponse(int statusCode, std::string &statusString);
-
- void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
- void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
- void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming);
- void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
- void sessionGroupAddedEvent(std::string &sessionGroupHandle);
- void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
- void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
- void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
- void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
- void auxAudioPropertiesEvent(F32 energy);
- void buddyPresenceEvent(std::string &uriString, std::string &alias, std::string &statusString, std::string &applicationString);
- void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
- void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
- void subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType);
-
- void buddyListChanged();
- void muteListChanged();
- void updateFriends(U32 mask);
-
- /////////////////////////////
- // Sending updates of current state
-static void updatePosition(void);
- void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
- void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
- bool channelFromRegion(LLViewerRegion *region, std::string &name);
- void leaveChannel(void); // call this on logout or teleport begin
-
-
- void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
- bool getMuteMic() const;
- void setUserPTTState(bool ptt);
- bool getUserPTTState();
- void toggleUserPTTState(void);
- void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
- void setVoiceEnabled(bool enabled);
- static bool voiceEnabled();
- // Checks is voice working judging from mState
- // Returns true if vivox has successfully logged in and is not in error state
- bool voiceWorking();
- void setUsePTT(bool usePTT);
- void setPTTIsToggle(bool PTTIsToggle);
- bool getPTTIsToggle();
- void setPTTKey(std::string &key);
- void setEarLocation(S32 loc);
- void setVoiceVolume(F32 volume);
- void setMicGain(F32 volume);
- void setUserVolume(const LLUUID& id, F32 volume); // sets volume for specified agent, from 0-1 (where .5 is nominal)
- void setLipSyncEnabled(BOOL enabled);
- BOOL lipSyncEnabled();
-
- // PTT key triggering
- void keyDown(KEY key, MASK mask);
- void keyUp(KEY key, MASK mask);
- void middleMouseState(bool down);
-
- // Return the version of the Vivox library
- std::string getAPIVersion() const { return mAPIVersion; }
-
- /////////////////////////////
- // Accessors for data related to nearby speakers
- BOOL getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar
- BOOL getIsSpeaking(const LLUUID& id);
- BOOL getIsModeratorMuted(const LLUUID& id);
- F32 getCurrentPower(const LLUUID& id); // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
- BOOL getOnMuteList(const LLUUID& id);
- F32 getUserVolume(const LLUUID& id);
- std::string getDisplayName(const LLUUID& id);
-
- // MBW -- XXX -- Not sure how to get this data out of the TVC
- BOOL getUsingPTT(const LLUUID& id);
- std::string getGroupID(const LLUUID& id); // group ID if the user is in group chat (empty string if not applicable)
-
- /////////////////////////////
- BOOL getAreaVoiceDisabled(); // returns true if the area the avatar is in is speech-disabled.
- // Use this to determine whether to show a "no speech" icon in the menu bar.
-
- /////////////////////////////
- // Recording controls
- void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
- void recordingLoopSave(const std::string& filename);
- void recordingStop();
-
- // Playback controls
- void filePlaybackStart(const std::string& filename);
- void filePlaybackStop();
- void filePlaybackSetPaused(bool paused);
- void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
-
-
- // This is used by the string-keyed maps below, to avoid storing the string twice.
- // The 'const std::string *' in the key points to a string actually stored in the object referenced by the map.
- // The add and delete operations for each map allocate and delete in the right order to avoid dangling references.
- // The default compare operation would just compare pointers, which is incorrect, so they must use this comparitor instead.
- struct stringMapComparitor
- {
- bool operator()(const std::string* a, const std::string * b) const
- {
- return a->compare(*b) < 0;
- }
- };
-
- struct uuidMapComparitor
- {
- bool operator()(const LLUUID* a, const LLUUID * b) const
- {
- return *a < *b;
- }
- };
-
- struct participantState
- {
- public:
- participantState(const std::string &uri);
-
- bool updateMuteState(); // true if mute state has changed
- bool isAvatar();
-
- std::string mURI;
- LLUUID mAvatarID;
- std::string mAccountName;
- std::string mDisplayName;
- LLFrameTimer mSpeakingTimeout;
- F32 mLastSpokeTimestamp;
- F32 mPower;
- F32 mVolume;
- std::string mGroupID;
- bool mPTT;
- bool mIsSpeaking;
- bool mIsModeratorMuted;
- bool mOnMuteList; // true if this avatar is on the user's mute list (and should be muted)
- bool mVolumeSet; // true if incoming volume messages should not change the volume
- bool mVolumeDirty; // true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
- bool mAvatarIDValid;
- bool mIsSelf;
- };
- typedef std::map<const std::string *, participantState*, stringMapComparitor> participantMap;
-
- typedef std::map<const LLUUID *, participantState*, uuidMapComparitor> participantUUIDMap;
-
- enum streamState
- {
- streamStateUnknown = 0,
- streamStateIdle = 1,
- streamStateConnected = 2,
- streamStateRinging = 3,
- };
-
- struct sessionState
- {
- public:
- sessionState();
- ~sessionState();
-
- participantState *addParticipant(const std::string &uri);
- // Note: after removeParticipant returns, the participant* that was passed to it will have been deleted.
- // Take care not to use the pointer again after that.
- void removeParticipant(participantState *participant);
- void removeAllParticipants();
-
- participantState *findParticipant(const std::string &uri);
- participantState *findParticipantByID(const LLUUID& id);
-
- bool isCallBackPossible();
- bool isTextIMPossible();
-
- std::string mHandle;
- std::string mGroupHandle;
- std::string mSIPURI;
- std::string mAlias;
- std::string mName;
- std::string mAlternateSIPURI;
- std::string mHash; // Channel password
- std::string mErrorStatusString;
- std::queue<std::string> mTextMsgQueue;
-
- LLUUID mIMSessionID;
- LLUUID mCallerID;
- int mErrorStatusCode;
- int mMediaStreamState;
- int mTextStreamState;
- bool mCreateInProgress; // True if a Session.Create has been sent for this session and no response has been received yet.
- bool mMediaConnectInProgress; // True if a Session.MediaConnect has been sent for this session and no response has been received yet.
- bool mVoiceInvitePending; // True if a voice invite is pending for this session (usually waiting on a name lookup)
- bool mTextInvitePending; // True if a text invite is pending for this session (usually waiting on a name lookup)
- bool mSynthesizedCallerID; // True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
- bool mIsChannel; // True for both group and spatial channels (false for p2p, PSTN)
- bool mIsSpatial; // True for spatial channels
- bool mIsP2P;
- bool mIncoming;
- bool mVoiceEnabled;
- bool mReconnect; // Whether we should try to reconnect to this session if it's dropped
- // Set to true when the mute state of someone in the participant list changes.
- // The code will have to walk the list to find the changed participant(s).
- bool mVolumeDirty;
- bool mMuteDirty;
-
- bool mParticipantsChanged;
- participantMap mParticipantsByURI;
- participantUUIDMap mParticipantsByUUID;
- };
-
- participantState *findParticipantByID(const LLUUID& id);
- participantMap *getParticipantList(void);
- void getParticipantsUUIDSet(std::set<LLUUID>& participant_uuids);
-
- typedef std::map<const std::string*, sessionState*, stringMapComparitor> sessionMap;
- typedef std::set<sessionState*> sessionSet;
-
- typedef sessionSet::iterator sessionIterator;
- sessionIterator sessionsBegin(void);
- sessionIterator sessionsEnd(void);
-
- sessionState *findSession(const std::string &handle);
- sessionState *findSessionBeingCreatedByURI(const std::string &uri);
- sessionState *findSession(const LLUUID &participant_id);
- sessionState *findSessionByCreateID(const std::string &create_id);
-
- sessionState *addSession(const std::string &uri, const std::string &handle = LLStringUtil::null);
- void setSessionHandle(sessionState *session, const std::string &handle = LLStringUtil::null);
- void setSessionURI(sessionState *session, const std::string &uri);
- void deleteSession(sessionState *session);
- void deleteAllSessions(void);
+ virtual void init(LLPumpIO *pump)=0; // Call this once at application startup (creates connector)
+ virtual void terminate()=0; // Call this to clean up during shutdown
+
+ virtual void updateSettings()=0; // call after loading settings and whenever they change
+
+ virtual bool isVoiceWorking()=0; // connected to a voice server and voice channel
- void verifySessionState(void);
+ virtual const LLVoiceVersionInfo& getVersion()=0;
+
+ /////////////////////
+ /// @name Tuning
+ //@{
+ virtual void tuningStart()=0;
+ virtual void tuningStop()=0;
+ virtual bool inTuningMode()=0;
+
+ virtual void tuningSetMicVolume(float volume)=0;
+ virtual void tuningSetSpeakerVolume(float volume)=0;
+ virtual float tuningGetEnergy(void)=0;
+ //@}
+
+ /////////////////////
+ /// @name Devices
+ //@{
+ // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+ // i.e. when the daemon is running and connected, and the device lists are populated.
+ virtual bool deviceSettingsAvailable()=0;
+
+ // Requery the vivox daemon for the current list of input/output devices.
+ // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+ // (use this if you want to know when it's done).
+ // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+ virtual void refreshDeviceLists(bool clearCurrentList = true)=0;
+
+ virtual void setCaptureDevice(const std::string& name)=0;
+ virtual void setRenderDevice(const std::string& name)=0;
+
+ virtual LLVoiceDeviceList& getCaptureDevices()=0;
+ virtual LLVoiceDeviceList& getRenderDevices()=0;
+
+ virtual void getParticipantList(std::set<LLUUID> &participants)=0;
+ virtual bool isParticipant(const LLUUID& speaker_id)=0;
+ //@}
+
+ ////////////////////////////
+ /// @ name Channel stuff
+ //@{
+ // returns true iff the user is currently in a proximal (local spatial) channel.
+ // Note that gestures should only fire if this returns true.
+ virtual bool inProximalChannel()=0;
+
+ virtual void setNonSpatialChannel(const std::string &uri,
+ const std::string &credentials)=0;
+
+ virtual void setSpatialChannel(const std::string &uri,
+ const std::string &credentials)=0;
+
+ virtual void leaveNonSpatialChannel()=0;
+
+ virtual void leaveChannel(void)=0;
+
+ // Returns the URI of the current channel, or an empty string if not currently in a channel.
+ // NOTE that it will return an empty string if it's in the process of joining a channel.
+ virtual std::string getCurrentChannel()=0;
+ //@}
+
+
+ //////////////////////////
+ /// @name invitations
+ //@{
+ // start a voice channel with the specified user
+ virtual void callUser(const LLUUID &uuid)=0;
+ virtual bool isValidChannel(std::string& channelHandle)=0;
+ virtual bool answerInvite(std::string &channelHandle)=0;
+ virtual void declineInvite(std::string &channelHandle)=0;
+ //@}
+
+ /////////////////////////
+ /// @name Volume/gain
+ //@{
+ virtual void setVoiceVolume(F32 volume)=0;
+ virtual void setMicGain(F32 volume)=0;
+ //@}
+
+ /////////////////////////
+ /// @name enable disable voice and features
+ //@{
+ virtual bool voiceEnabled()=0;
+ virtual void setVoiceEnabled(bool enabled)=0;
+ virtual void setLipSyncEnabled(BOOL enabled)=0;
+ virtual BOOL lipSyncEnabled()=0;
+ virtual void setMuteMic(bool muted)=0; // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+ //@}
+
+ ////////////////////////
+ /// @name PTT
+ //@{
+ virtual void setUserPTTState(bool ptt)=0;
+ virtual bool getUserPTTState()=0;
+ virtual void setUsePTT(bool usePTT)=0;
+ virtual void setPTTIsToggle(bool PTTIsToggle)=0;
+ virtual bool getPTTIsToggle()=0;
+ virtual void toggleUserPTTState(void)=0;
+ virtual void inputUserControlState(bool down)=0; // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+
+ virtual void keyDown(KEY key, MASK mask)=0;
+ virtual void keyUp(KEY key, MASK mask)=0;
+ virtual void middleMouseState(bool down)=0;
+ //@}
+
+ //////////////////////////
+ /// @name nearby speaker accessors
+ //@{
+
+
+ virtual BOOL getVoiceEnabled(const LLUUID& id)=0; // true if we've received data for this avatar
+ virtual std::string getDisplayName(const LLUUID& id)=0;
+ virtual BOOL isOnlineSIP(const LLUUID &id)=0;
+ virtual BOOL isParticipantAvatar(const LLUUID &id)=0;
+ virtual BOOL getIsSpeaking(const LLUUID& id)=0;
+ virtual BOOL getIsModeratorMuted(const LLUUID& id)=0;
+ virtual F32 getCurrentPower(const LLUUID& id)=0; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
+ virtual BOOL getOnMuteList(const LLUUID& id)=0;
+ virtual F32 getUserVolume(const LLUUID& id)=0;
+ virtual void setUserVolume(const LLUUID& id, F32 volume)=0; // set's volume for specified agent, from 0-1 (where .5 is nominal)
+ //@}
+
+ //////////////////////////
+ /// @name text chat
+ //@{
+ virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0;
+ virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0;
+ virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0;
+ virtual void endUserIMSession(const LLUUID &uuid)=0;
+ //@}
+
+ // authorize the user
+ virtual void userAuthorized(const std::string& user_id,
+ const LLUUID &agentID)=0;
+
+ //////////////////////////////
+ /// @name Status notification
+ //@{
+ virtual void addObserver(LLVoiceClientStatusObserver* observer)=0;
+ virtual void removeObserver(LLVoiceClientStatusObserver* observer)=0;
+ virtual void addObserver(LLFriendObserver* observer)=0;
+ virtual void removeObserver(LLFriendObserver* observer)=0;
+ virtual void addObserver(LLVoiceClientParticipantObserver* observer)=0;
+ virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0;
+ //@}
+
+ virtual std::string sipURIFromID(const LLUUID &id)=0;
+ //@}
+
+};
- void joinedAudioSession(sessionState *session);
- void leftAudioSession(sessionState *session);
- // This is called in several places where the session _may_ need to be deleted.
- // It contains logic for whether to delete the session or keep it around.
- void reapSession(sessionState *session);
-
- // Returns true if the session seems to indicate we've moved to a region on a different voice server
- bool sessionNeedsRelog(sessionState *session);
-
- struct buddyListEntry
- {
- buddyListEntry(const std::string &uri);
- std::string mURI;
- std::string mDisplayName;
- LLUUID mUUID;
- bool mOnlineSL;
- bool mOnlineSLim;
- bool mCanSeeMeOnline;
- bool mHasBlockListEntry;
- bool mHasAutoAcceptListEntry;
- bool mNameResolved;
- bool mInSLFriends;
- bool mInVivoxBuddies;
- bool mNeedsNameUpdate;
- };
-
- typedef std::map<const std::string*, buddyListEntry*, stringMapComparitor> buddyListMap;
-
- // This should be called when parsing a buddy list entry sent by SLVoice.
- void processBuddyListEntry(const std::string &uri, const std::string &displayName);
-
- buddyListEntry *addBuddy(const std::string &uri);
- buddyListEntry *addBuddy(const std::string &uri, const std::string &displayName);
- buddyListEntry *findBuddy(const std::string &uri);
- buddyListEntry *findBuddy(const LLUUID &id);
- buddyListEntry *findBuddyByDisplayName(const std::string &name);
- void deleteBuddy(const std::string &uri);
- void deleteAllBuddies(void);
-
- void deleteAllBlockRules(void);
- void addBlockRule(const std::string &blockMask, const std::string &presenceOnly);
- void deleteAllAutoAcceptRules(void);
- void addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy);
- void accountListBlockRulesResponse(int statusCode, const std::string &statusString);
- void accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString);
-
- /////////////////////////////
- // session control messages
- void connectorCreate();
- void connectorShutdown();
-
- void requestVoiceAccountProvision(S32 retries = 3);
- void userAuthorized(
- const std::string& firstName,
- const std::string& lastName,
- const LLUUID &agentID);
- void login(
- const std::string& account_name,
- const std::string& password,
- const std::string& voice_sip_uri_hostname,
- const std::string& voice_account_server_uri);
- void loginSendMessage();
- void logout();
- void logoutSendMessage();
-
- void accountListBlockRulesSendMessage();
- void accountListAutoAcceptRulesSendMessage();
-
- void sessionGroupCreateSendMessage();
- void sessionCreateSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
- void sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
- void sessionMediaConnectSendMessage(sessionState *session); // just joins the audio session
- void sessionTextConnectSendMessage(sessionState *session); // just joins the text session
- void sessionTerminateSendMessage(sessionState *session);
- void sessionGroupTerminateSendMessage(sessionState *session);
- void sessionMediaDisconnectSendMessage(sessionState *session);
- void sessionTextDisconnectSendMessage(sessionState *session);
-
- // Pokes the state machine to leave the audio session next time around.
- void sessionTerminate();
-
- // Pokes the state machine to shut down the connector and restart it.
- void requestRelog();
-
- // Does the actual work to get out of the audio session
- void leaveAudioSession();
-
- void addObserver(LLVoiceClientParticipantObserver* observer);
- void removeObserver(LLVoiceClientParticipantObserver* observer);
+class LLVoiceClient: public LLSingleton<LLVoiceClient>
+{
+ LOG_CLASS(LLVoiceClient);
+public:
+ LLVoiceClient();
+ ~LLVoiceClient();
- void addObserver(LLVoiceClientStatusObserver* observer);
- void removeObserver(LLVoiceClientStatusObserver* observer);
+ void init(LLPumpIO *pump); // Call this once at application startup (creates connector)
+ void terminate(); // Call this to clean up during shutdown
+
+ const LLVoiceVersionInfo getVersion();
+
+ static const F32 OVERDRIVEN_POWER_LEVEL;
- void addObserver(LLFriendObserver* observer);
- void removeObserver(LLFriendObserver* observer);
-
- void lookupName(const LLUUID &id);
- static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
- void avatarNameResolved(const LLUUID &id, const std::string &name);
-
- typedef std::vector<std::string> deviceList;
+ static const F32 VOLUME_MIN;
+ static const F32 VOLUME_DEFAULT;
+ static const F32 VOLUME_MAX;
- deviceList *getCaptureDevices();
- deviceList *getRenderDevices();
-
- void setNonSpatialChannel(
- const std::string &uri,
- const std::string &credentials);
- void setSpatialChannel(
- const std::string &uri,
- const std::string &credentials);
- // start a voice session with the specified user
- void callUser(const LLUUID &uuid);
-
- // Send a text message to the specified user, initiating the session if necessary.
- bool sendTextMessage(const LLUUID& participant_id, const std::string& message);
-
- // close any existing text IM session with the specified user
- void endUserIMSession(const LLUUID &uuid);
-
- bool answerInvite(std::string &sessionHandle);
- void declineInvite(std::string &sessionHandle);
- void leaveNonSpatialChannel();
+ void updateSettings(); // call after loading settings and whenever they change
- // Returns the URI of the current channel, or an empty string if not currently in a channel.
- // NOTE that it will return an empty string if it's in the process of joining a channel.
- std::string getCurrentChannel();
-
- // returns true iff the user is currently in a proximal (local spatial) channel.
- // Note that gestures should only fire if this returns true.
- bool inProximalChannel();
+ bool isVoiceWorking(); // connected to a voice server and voice channel
- std::string sipURIFromID(const LLUUID &id);
-
- // Returns true if the indicated user is online via SIP presence according to SLVoice.
- // Note that we only get SIP presence data for other users that are in our vivox buddy list.
- bool isOnlineSIP(const LLUUID &id);
-
- // Returns true if the indicated participant is really an SL avatar.
- // This should be used to control the state of the "profile" button.
- // Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
- bool isParticipantAvatar(const LLUUID &id);
-
- // Returns true if calling back the session URI after the session has closed is possible.
- // Currently this will be false only for PSTN P2P calls.
- // NOTE: this will return true if the session can't be found.
- bool isSessionCallBackPossible(const LLUUID &session_id);
-
- // Returns true if the session can accepte text IM's.
- // Currently this will be false only for PSTN P2P calls.
- // NOTE: this will return true if the session can't be found.
- bool isSessionTextIMPossible(const LLUUID &session_id);
-
- private:
-
- // internal state for a simple state machine. This is used to deal with the asynchronous nature of some of the messages.
- // Note: if you change this list, please make corresponding changes to LLVoiceClient::state2string().
- enum state
- {
- stateDisableCleanup,
- stateDisabled, // Voice is turned off.
- stateStart, // Class is initialized, socket is created
- stateDaemonLaunched, // Daemon has been launched
- stateConnecting, // connect() call has been issued
- stateConnected, // connection to the daemon has been made, send some initial setup commands.
- stateIdle, // socket is connected, ready for messaging
- stateMicTuningStart,
- stateMicTuningRunning,
- stateMicTuningStop,
- stateConnectorStart, // connector needs to be started
- stateConnectorStarting, // waiting for connector handle
- stateConnectorStarted, // connector handle received
- stateLoginRetry, // need to retry login (failed due to changing password)
- stateLoginRetryWait, // waiting for retry timer
- stateNeedsLogin, // send login request
- stateLoggingIn, // waiting for account handle
- stateLoggedIn, // account handle received
- stateCreatingSessionGroup, // Creating the main session group
- stateNoChannel, //
- stateJoiningSession, // waiting for session handle
- stateSessionJoined, // session handle received
- stateRunning, // in session, steady state
- stateLeavingSession, // waiting for terminate session response
- stateSessionTerminated, // waiting for terminate session response
-
- stateLoggingOut, // waiting for logout response
- stateLoggedOut, // logout response received
- stateConnectorStopping, // waiting for connector stop
- stateConnectorStopped, // connector stop received
-
- // We go to this state if the login fails because the account needs to be provisioned.
-
- // error states. No way to recover from these yet.
- stateConnectorFailed,
- stateConnectorFailedWaiting,
- stateLoginFailed,
- stateLoginFailedWaiting,
- stateJoinSessionFailed,
- stateJoinSessionFailedWaiting,
-
- stateJail // Go here when all else has failed. Nothing will be retried, we're done.
- };
+ // tuning
+ void tuningStart();
+ void tuningStop();
+ bool inTuningMode();
- state mState;
- bool mSessionTerminateRequested;
- bool mRelogRequested;
- // Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine().
- // The larger it is the greater is possibility there is a problem with connection to voice server.
- // Introduced while fixing EXT-4313.
- int mSpatialJoiningNum;
-
- void setState(state inState);
- state getState(void) { return mState; };
- static std::string state2string(state inState);
-
- void stateMachine();
- static void idle(void *user_data);
-
- LLHost mDaemonHost;
- LLSocket::ptr_t mSocket;
- bool mConnected;
-
- void closeSocket(void);
-
- LLPumpIO *mPump;
- friend class LLVivoxProtocolParser;
-
- std::string mAccountName;
- std::string mAccountPassword;
- std::string mAccountDisplayName;
- std::string mAccountFirstName;
- std::string mAccountLastName;
+ void tuningSetMicVolume(float volume);
+ void tuningSetSpeakerVolume(float volume);
+ float tuningGetEnergy(void);
- bool mTuningMode;
- float mTuningEnergy;
- std::string mTuningAudioFile;
- int mTuningMicVolume;
- bool mTuningMicVolumeDirty;
- int mTuningSpeakerVolume;
- bool mTuningSpeakerVolumeDirty;
- state mTuningExitState; // state to return to when we leave tuning mode.
+ // devices
+
+ // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+ // i.e. when the daemon is running and connected, and the device lists are populated.
+ bool deviceSettingsAvailable();
- std::string mSpatialSessionURI;
- std::string mSpatialSessionCredentials;
+ // Requery the vivox daemon for the current list of input/output devices.
+ // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+ // (use this if you want to know when it's done).
+ // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+ void refreshDeviceLists(bool clearCurrentList = true);
- std::string mMainSessionGroupHandle; // handle of the "main" session group.
-
- std::string mChannelName; // Name of the channel to be looked up
- bool mAreaVoiceDisabled;
- sessionState *mAudioSession; // Session state for the current audio session
- bool mAudioSessionChanged; // set to true when the above pointer gets changed, so observers can be notified.
+ void setCaptureDevice(const std::string& name);
+ void setRenderDevice(const std::string& name);
- sessionState *mNextAudioSession; // Session state for the audio session we're trying to join
+ const LLVoiceDeviceList& getCaptureDevices();
+ const LLVoiceDeviceList& getRenderDevices();
-// std::string mSessionURI; // URI of the session we're in.
-// std::string mSessionHandle; // returned by ?
-
- S32 mCurrentParcelLocalID; // Used to detect parcel boundary crossings
- std::string mCurrentRegionName; // Used to detect parcel boundary crossings
-
- std::string mConnectorHandle; // returned by "Create Connector" message
- std::string mAccountHandle; // returned by login message
- int mNumberOfAliases;
- U32 mCommandCookie;
+ ////////////////////////////
+ // Channel stuff
+ //
+
+ // returns true iff the user is currently in a proximal (local spatial) channel.
+ // Note that gestures should only fire if this returns true.
+ bool inProximalChannel();
+ void setNonSpatialChannel(
+ const std::string &uri,
+ const std::string &credentials);
+ void setSpatialChannel(
+ const std::string &uri,
+ const std::string &credentials);
+ void leaveNonSpatialChannel();
+
+ // Returns the URI of the current channel, or an empty string if not currently in a channel.
+ // NOTE that it will return an empty string if it's in the process of joining a channel.
+ std::string getCurrentChannel();
+ // start a voice channel with the specified user
+ void callUser(const LLUUID &uuid);
+ bool isValidChannel(std::string& channelHandle);
+ bool answerInvite(std::string &channelHandle);
+ void declineInvite(std::string &channelHandle);
+ void leaveChannel(void); // call this on logout or teleport begin
+
+
+ /////////////////////////////
+ // Sending updates of current state
- std::string mVoiceAccountServerURI;
- std::string mVoiceSIPURIHostName;
-
- int mLoginRetryCount;
-
- sessionMap mSessionsByHandle; // Active sessions, indexed by session handle. Sessions which are being initiated may not be in this map.
- sessionSet mSessions; // All sessions, not indexed. This is the canonical session list.
-
- bool mBuddyListMapPopulated;
- bool mBlockRulesListReceived;
- bool mAutoAcceptRulesListReceived;
- buddyListMap mBuddyListMap;
-
- deviceList mCaptureDevices;
- deviceList mRenderDevices;
-
- std::string mCaptureDevice;
- std::string mRenderDevice;
- bool mCaptureDeviceDirty;
- bool mRenderDeviceDirty;
-
- // This should be called when the code detects we have changed parcels.
- // It initiates the call to the server that gets the parcel channel.
- void parcelChanged();
-
- void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
- void joinSession(sessionState *session);
-
-static std::string nameFromAvatar(LLVOAvatar *avatar);
-static std::string nameFromID(const LLUUID &id);
-static bool IDFromName(const std::string name, LLUUID &uuid);
-static std::string displayNameFromAvatar(LLVOAvatar *avatar);
- std::string sipURIFromAvatar(LLVOAvatar *avatar);
- std::string sipURIFromName(std::string &name);
-
- // Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
-static std::string nameFromsipURI(const std::string &uri);
- bool inSpatialChannel(void);
- std::string getAudioSessionURI();
- std::string getAudioSessionHandle();
-
- void sendPositionalUpdate(void);
-
- void buildSetCaptureDevice(std::ostringstream &stream);
- void buildSetRenderDevice(std::ostringstream &stream);
- void buildLocalAudioUpdates(std::ostringstream &stream);
-
- void clearAllLists();
- void checkFriend(const LLUUID& id);
- void sendFriendsListUpdates();
-
- // start a text IM session with the specified user
- // This will be asynchronous, the session may be established at a future time.
- sessionState* startUserIMSession(const LLUUID& uuid);
- void sendQueuedTextMessages(sessionState *session);
-
- void enforceTether(void);
-
- bool mSpatialCoordsDirty;
-
- LLVector3d mCameraPosition;
- LLVector3d mCameraRequestedPosition;
- LLVector3 mCameraVelocity;
- LLMatrix3 mCameraRot;
-
- LLVector3d mAvatarPosition;
- LLVector3 mAvatarVelocity;
- LLMatrix3 mAvatarRot;
-
- bool mPTTDirty;
- bool mPTT;
-
- bool mUsePTT;
- bool mPTTIsMiddleMouse;
- KEY mPTTKey;
- bool mPTTIsToggle;
- bool mUserPTTState;
- bool mMuteMic;
-
- // Set to true when the friends list is known to have changed.
- bool mFriendsListDirty;
-
- enum
- {
- earLocCamera = 0, // ear at camera
- earLocAvatar, // ear at avatar
- earLocMixed // ear at avatar location/camera direction
- };
-
- S32 mEarLocation;
-
- bool mSpeakerVolumeDirty;
- bool mSpeakerMuteDirty;
- int mSpeakerVolume;
+ void setVoiceVolume(F32 volume);
+ void setMicGain(F32 volume);
+ void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)
+ bool voiceEnabled();
+ void setLipSyncEnabled(BOOL enabled);
+ void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+ void setUserPTTState(bool ptt);
+ bool getUserPTTState();
+ void toggleUserPTTState(void);
+ void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+ void setVoiceEnabled(bool enabled);
+
+ void setUsePTT(bool usePTT);
+ void setPTTIsToggle(bool PTTIsToggle);
+ bool getPTTIsToggle();
+
+ BOOL lipSyncEnabled();
+
+ // PTT key triggering
+ void keyDown(KEY key, MASK mask);
+ void keyUp(KEY key, MASK mask);
+ void middleMouseState(bool down);
+
+
+ /////////////////////////////
+ // Accessors for data related to nearby speakers
+ BOOL getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar
+ std::string getDisplayName(const LLUUID& id);
+ BOOL isOnlineSIP(const LLUUID &id);
+ BOOL isParticipantAvatar(const LLUUID &id);
+ BOOL getIsSpeaking(const LLUUID& id);
+ BOOL getIsModeratorMuted(const LLUUID& id);
+ F32 getCurrentPower(const LLUUID& id); // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
+ BOOL getOnMuteList(const LLUUID& id);
+ F32 getUserVolume(const LLUUID& id);
+
+ /////////////////////////////
+ BOOL getAreaVoiceDisabled(); // returns true if the area the avatar is in is speech-disabled.
+ // Use this to determine whether to show a "no speech" icon in the menu bar.
+ void getParticipantList(std::set<LLUUID> &participants);
+ bool isParticipant(const LLUUID& speaker_id);
+
+ //////////////////////////
+ /// @name text chat
+ //@{
+ BOOL isSessionTextIMPossible(const LLUUID& id);
+ BOOL isSessionCallBackPossible(const LLUUID& id);
+ BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message);
+ void endUserIMSession(const LLUUID &uuid);
+ //@}
+
- int mMicVolume;
- bool mMicVolumeDirty;
-
- bool mVoiceEnabled;
- bool mWriteInProgress;
- std::string mWriteString;
-
- LLTimer mUpdateTimer;
+ void userAuthorized(const std::string& user_id,
+ const LLUUID &agentID);
+
+ void addObserver(LLVoiceClientStatusObserver* observer);
+ void removeObserver(LLVoiceClientStatusObserver* observer);
+ void addObserver(LLFriendObserver* observer);
+ void removeObserver(LLFriendObserver* observer);
+ void addObserver(LLVoiceClientParticipantObserver* observer);
+ void removeObserver(LLVoiceClientParticipantObserver* observer);
+
+ std::string sipURIFromID(const LLUUID &id);
- BOOL mLipSyncEnabled;
-
- std::string mAPIVersion;
-
- typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
- observer_set_t mParticipantObservers;
-
- void notifyParticipantObservers();
+protected:
+ LLVoiceModuleInterface* mVoiceModule;
+ LLPumpIO *m_servicePump;
+};
- typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
- status_observer_set_t mStatusObservers;
-
- void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
+/**
+ * Speaker volume storage helper class
+ **/
+class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
+{
+ LOG_CLASS(LLSpeakerVolumeStorage);
+public:
- typedef std::set<LLFriendObserver*> friend_observer_set_t;
- friend_observer_set_t mFriendObservers;
- void notifyFriendObservers();
+ /**
+ * Stores volume level for specified user.
+ *
+ * @param[in] speaker_id - LLUUID of user to store volume level for.
+ * @param[in] volume - volume level to be stored for user.
+ */
+ void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
+
+ /**
+ * Gets stored volume level for specified speaker
+ *
+ * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
+ * @param[out] volume - set to stored volume if found, otherwise unmodified.
+ * @return - true if a stored volume is found.
+ */
+ bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
+
+ /**
+ * Removes stored volume level for specified user.
+ *
+ * @param[in] speaker_id - LLUUID of user to remove.
+ */
+ void removeSpeakerVolume(const LLUUID& speaker_id);
+
+private:
+ friend class LLSingleton<LLSpeakerVolumeStorage>;
+ LLSpeakerVolumeStorage();
+ ~LLSpeakerVolumeStorage();
+
+ const static std::string SETTINGS_FILE_NAME;
+
+ void load();
+ void save();
+
+ static F32 transformFromLegacyVolume(F32 volume_in);
+ static F32 transformToLegacyVolume(F32 volume_in);
+
+ typedef std::map<LLUUID, F32> speaker_data_map_t;
+ speaker_data_map_t mSpeakersData;
};
-extern LLVoiceClient *gVoiceClient;
-
#endif //LL_VOICE_CLIENT_H
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
new file mode 100644
index 0000000000..bcb1a70efb
--- /dev/null
+++ b/indra/newview/llvoicevivox.cpp
@@ -0,0 +1,6944 @@
+ /**
+ * @file LLVivoxVoiceClient.cpp
+ * @brief Implementation of LLVivoxVoiceClient class which is the interface to the voice client process.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2010, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llvoicevivox.h"
+
+#include <boost/tokenizer.hpp>
+
+#include "llsdutil.h"
+
+#include "llvoavatarself.h"
+#include "llbufferstream.h"
+#include "llfile.h"
+#ifdef LL_STANDALONE
+# include "expat.h"
+#else
+# include "expat/expat.h"
+#endif
+#include "llcallbacklist.h"
+#include "llviewerregion.h"
+#include "llviewernetwork.h" // for gGridChoice
+#include "llbase64.h"
+#include "llviewercontrol.h"
+#include "llkeyboard.h"
+#include "llappviewer.h" // for gDisconnected, gDisableVoice
+#include "llmutelist.h" // to check for muted avatars
+#include "llagent.h"
+#include "llcachename.h"
+#include "llimview.h" // for LLIMMgr
+#include "llparcel.h"
+#include "llviewerparcelmgr.h"
+//#include "llfirstuse.h"
+#include "llspeakers.h"
+#include "llviewerwindow.h"
+#include "llviewercamera.h"
+
+#include "llfloaterfriends.h" //VIVOX, inorder to refresh communicate panel
+#include "llviewernetwork.h"
+#include "llnotificationsutil.h"
+
+// for base64 decoding
+#include "apr_base64.h"
+
+// for SHA1 hash
+#include "apr_sha1.h"
+
+// for MD5 hash
+#include "llmd5.h"
+
+#define USE_SESSION_GROUPS 0
+
+const F32 VOLUME_SCALE_VIVOX = 0.01f;
+
+const F32 SPEAKING_TIMEOUT = 1.f;
+
+static const std::string VOICE_SERVER_TYPE = "Vivox";
+
+// Don't retry connecting to the daemon more frequently than this:
+const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
+
+// Don't send positional updates more frequently than this:
+const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
+
+const F32 LOGIN_RETRY_SECONDS = 10.0f;
+const int MAX_LOGIN_RETRIES = 12;
+
+// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine()
+// which is treated as normal. If this number is exceeded we suspect there is a problem with connection
+// to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen
+// to make sure we don't make mistake when slight connection problems happen- situation when connection to server is
+// blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability.
+const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50;
+
+
+static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str)
+{
+ LLMD5 md5_uuid;
+ md5_uuid.update((const unsigned char*)str.data(), str.size());
+ md5_uuid.finalize();
+ md5_uuid.raw_digest(uuid.mData);
+}
+
+static int scale_mic_volume(float volume)
+{
+ // incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.
+ // Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70
+ return 30 + (int)(volume * 20.0f);
+}
+
+static int scale_speaker_volume(float volume)
+{
+ // incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
+ // Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70
+ return 30 + (int)(volume * 40.0f);
+
+}
+
+class LLVivoxVoiceAccountProvisionResponder :
+ public LLHTTPClient::Responder
+{
+public:
+ LLVivoxVoiceAccountProvisionResponder(int retries)
+ {
+ mRetries = retries;
+ }
+
+ virtual void error(U32 status, const std::string& reason)
+ {
+ if ( mRetries > 0 )
+ {
+ LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying. status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+ LLVivoxVoiceClient::getInstance()->requestVoiceAccountProvision(
+ mRetries - 1);
+ }
+ else
+ {
+ LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up). status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+ LLVivoxVoiceClient::getInstance()->giveUp();
+ }
+ }
+
+ virtual void result(const LLSD& content)
+ {
+
+ std::string voice_sip_uri_hostname;
+ std::string voice_account_server_uri;
+
+ LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+
+ if(content.has("voice_sip_uri_hostname"))
+ voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString();
+
+ // this key is actually misnamed -- it will be an entire URI, not just a hostname.
+ if(content.has("voice_account_server_name"))
+ voice_account_server_uri = content["voice_account_server_name"].asString();
+
+ LLVivoxVoiceClient::getInstance()->login(
+ content["username"].asString(),
+ content["password"].asString(),
+ voice_sip_uri_hostname,
+ voice_account_server_uri);
+
+ }
+
+private:
+ int mRetries;
+};
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVivoxVoiceClientMuteListObserver : public LLMuteListObserver
+{
+ /* virtual */ void onChange() { LLVivoxVoiceClient::getInstance()->muteListChanged();}
+};
+
+class LLVivoxVoiceClientFriendsObserver : public LLFriendObserver
+{
+public:
+ /* virtual */ void changed(U32 mask) { LLVivoxVoiceClient::getInstance()->updateFriends(mask);}
+};
+
+static LLVivoxVoiceClientMuteListObserver mutelist_listener;
+static bool sMuteListListener_listening = false;
+
+static LLVivoxVoiceClientFriendsObserver *friendslist_listener = NULL;
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVivoxVoiceClientCapResponder : public LLHTTPClient::Responder
+{
+public:
+ LLVivoxVoiceClientCapResponder(void){};
+
+ virtual void error(U32 status, const std::string& reason); // called with bad status codes
+ virtual void result(const LLSD& content);
+
+private:
+};
+
+void LLVivoxVoiceClientCapResponder::error(U32 status, const std::string& reason)
+{
+ LL_WARNS("Voice") << "LLVivoxVoiceClientCapResponder::error("
+ << status << ": " << reason << ")"
+ << LL_ENDL;
+}
+
+void LLVivoxVoiceClientCapResponder::result(const LLSD& content)
+{
+ LLSD::map_const_iterator iter;
+
+ LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+
+ if ( content.has("voice_credentials") )
+ {
+ LLSD voice_credentials = content["voice_credentials"];
+ std::string uri;
+ std::string credentials;
+
+ if ( voice_credentials.has("channel_uri") )
+ {
+ uri = voice_credentials["channel_uri"].asString();
+ }
+ if ( voice_credentials.has("channel_credentials") )
+ {
+ credentials =
+ voice_credentials["channel_credentials"].asString();
+ }
+
+ LLVivoxVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
+ }
+}
+
+
+
+#if LL_WINDOWS
+static HANDLE sGatewayHandle = 0;
+
+static bool isGatewayRunning()
+{
+ bool result = false;
+ if(sGatewayHandle != 0)
+ {
+ DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0);
+ if(waitresult != WAIT_OBJECT_0)
+ {
+ result = true;
+ }
+ }
+ return result;
+}
+static void killGateway()
+{
+ if(sGatewayHandle != 0)
+ {
+ TerminateProcess(sGatewayHandle,0);
+ }
+}
+
+#else // Mac and linux
+
+static pid_t sGatewayPID = 0;
+static bool isGatewayRunning()
+{
+ bool result = false;
+ if(sGatewayPID != 0)
+ {
+ // A kill with signal number 0 has no effect, just does error checking. It should return an error if the process no longer exists.
+ if(kill(sGatewayPID, 0) == 0)
+ {
+ result = true;
+ }
+ }
+ return result;
+}
+
+static void killGateway()
+{
+ if(sGatewayPID != 0)
+ {
+ kill(sGatewayPID, SIGTERM);
+ }
+}
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+LLVivoxVoiceClient::LLVivoxVoiceClient() :
+ mState(stateDisabled),
+ mSessionTerminateRequested(false),
+ mRelogRequested(false),
+ mConnected(false),
+ mPump(NULL),
+ mSpatialJoiningNum(0),
+
+ mTuningMode(false),
+ mTuningEnergy(0.0f),
+ mTuningMicVolume(0),
+ mTuningMicVolumeDirty(true),
+ mTuningSpeakerVolume(0),
+ mTuningSpeakerVolumeDirty(true),
+ mTuningExitState(stateDisabled),
+
+ mAreaVoiceDisabled(false),
+ mAudioSession(NULL),
+ mAudioSessionChanged(false),
+ mNextAudioSession(NULL),
+
+ mCurrentParcelLocalID(0),
+ mNumberOfAliases(0),
+ mCommandCookie(0),
+ mLoginRetryCount(0),
+
+ mBuddyListMapPopulated(false),
+ mBlockRulesListReceived(false),
+ mAutoAcceptRulesListReceived(false),
+ mCaptureDeviceDirty(false),
+ mRenderDeviceDirty(false),
+ mSpatialCoordsDirty(false),
+
+ mPTTDirty(true),
+ mPTT(true),
+ mUsePTT(true),
+ mPTTIsMiddleMouse(false),
+ mPTTKey(0),
+ mPTTIsToggle(false),
+ mUserPTTState(false),
+ mMuteMic(false),
+ mFriendsListDirty(true),
+
+ mEarLocation(0),
+ mSpeakerVolumeDirty(true),
+ mSpeakerMuteDirty(true),
+ mMicVolume(0),
+ mMicVolumeDirty(true),
+
+ mVoiceEnabled(false),
+ mWriteInProgress(false),
+
+ mLipSyncEnabled(false)
+
+
+
+{
+ mSpeakerVolume = scale_speaker_volume(0);
+
+ mVoiceVersion.serverVersion = "";
+ mVoiceVersion.serverType = VOICE_SERVER_TYPE;
+
+ // gMuteListp isn't set up at this point, so we defer this until later.
+// gMuteListp->addObserver(&mutelist_listener);
+
+
+#if LL_DARWIN || LL_LINUX || LL_SOLARIS
+ // HACK: THIS DOES NOT BELONG HERE
+ // When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
+ // This should cause us to ignore SIGPIPE and handle the error through proper channels.
+ // This should really be set up elsewhere. Where should it go?
+ signal(SIGPIPE, SIG_IGN);
+
+ // Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
+ // Ignoring SIGCHLD should prevent zombies from being created. Alternately, we could use wait(), but I'd rather not do that.
+ signal(SIGCHLD, SIG_IGN);
+#endif
+
+ // set up state machine
+ setState(stateDisabled);
+
+ gIdleCallbacks.addFunction(idle, this);
+}
+
+//---------------------------------------------------
+
+LLVivoxVoiceClient::~LLVivoxVoiceClient()
+{
+}
+
+//----------------------------------------------
+
+void LLVivoxVoiceClient::init(LLPumpIO *pump)
+{
+ // constructor will set up LLVoiceClient::getInstance()
+ LLVivoxVoiceClient::getInstance()->mPump = pump;
+}
+
+void LLVivoxVoiceClient::terminate()
+{
+
+// leaveAudioSession();
+ logout();
+ // As of SDK version 4885, this should no longer be necessary. It will linger after the socket close if it needs to.
+ // ms_sleep(2000);
+ connectorShutdown();
+ closeSocket(); // Need to do this now -- bad things happen if the destructor does it later.
+
+ // This will do unpleasant things on windows.
+// killGateway();
+
+
+
+}
+
+const LLVoiceVersionInfo& LLVivoxVoiceClient::getVersion()
+{
+ return mVoiceVersion;
+}
+
+//---------------------------------------------------
+
+void LLVivoxVoiceClient::updateSettings()
+{
+ setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
+ setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
+ std::string keyString = gSavedSettings.getString("PushToTalkButton");
+ setPTTKey(keyString);
+ setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
+ setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
+
+ std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
+ setCaptureDevice(inputDevice);
+ std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
+ setRenderDevice(outputDevice);
+ F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
+ setMicGain(mic_level);
+ setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
+}
+
+/////////////////////////////
+// utility functions
+
+bool LLVivoxVoiceClient::writeString(const std::string &str)
+{
+ bool result = false;
+ if(mConnected)
+ {
+ apr_status_t err;
+ apr_size_t size = (apr_size_t)str.size();
+ apr_size_t written = size;
+
+ //MARK: Turn this on to log outgoing XML
+// LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
+
+ // check return code - sockets will fail (broken, etc.)
+ err = apr_socket_send(
+ mSocket->getSocket(),
+ (const char*)str.data(),
+ &written);
+
+ if(err == 0)
+ {
+ // Success.
+ result = true;
+ }
+ // TODO: handle partial writes (written is number of bytes written)
+ // Need to set socket to non-blocking before this will work.
+// else if(APR_STATUS_IS_EAGAIN(err))
+// {
+// //
+// }
+ else
+ {
+ // Assume any socket error means something bad. For now, just close the socket.
+ char buf[MAX_STRING];
+ LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
+ daemonDied();
+ }
+ }
+
+ return result;
+}
+
+
+/////////////////////////////
+// session control messages
+void LLVivoxVoiceClient::connectorCreate()
+{
+ std::ostringstream stream;
+ std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
+ std::string loglevel = "0";
+
+ // Transition to stateConnectorStarted when the connector handle comes back.
+ setState(stateConnectorStarting);
+
+ std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel");
+
+ if(savedLogLevel != "-1")
+ {
+ LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
+ loglevel = "10";
+ }
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
+ << "<ClientName>V2 SDK</ClientName>"
+ << "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
+ << "<Mode>Normal</Mode>"
+ << "<Logging>"
+ << "<Folder>" << logpath << "</Folder>"
+ << "<FileNamePrefix>Connector</FileNamePrefix>"
+ << "<FileNameSuffix>.log</FileNameSuffix>"
+ << "<LogLevel>" << loglevel << "</LogLevel>"
+ << "</Logging>"
+ << "<Application>SecondLifeViewer.1</Application>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::connectorShutdown()
+{
+ setState(stateConnectorStopping);
+
+ if(!mConnectorHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
+ << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+ << "</Request>"
+ << "\n\n\n";
+
+ mConnectorHandle.clear();
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
+{
+
+ mAccountDisplayName = user_id;
+
+ LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
+
+ mAccountName = nameFromID(agentID);
+}
+
+void LLVivoxVoiceClient::requestVoiceAccountProvision(S32 retries)
+{
+ if ( gAgent.getRegion() && mVoiceEnabled )
+ {
+ std::string url =
+ gAgent.getRegion()->getCapability(
+ "ProvisionVoiceAccountRequest");
+
+ if ( url == "" ) return;
+
+ LLHTTPClient::post(
+ url,
+ LLSD(),
+ new LLVivoxVoiceAccountProvisionResponder(retries));
+ }
+}
+
+void LLVivoxVoiceClient::login(
+ const std::string& account_name,
+ const std::string& password,
+ const std::string& voice_sip_uri_hostname,
+ const std::string& voice_account_server_uri)
+{
+ mVoiceSIPURIHostName = voice_sip_uri_hostname;
+ mVoiceAccountServerURI = voice_account_server_uri;
+
+ if(!mAccountHandle.empty())
+ {
+ // Already logged in.
+ LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
+
+ // Don't process another login.
+ return;
+ }
+ else if ( account_name != mAccountName )
+ {
+ //TODO: error?
+ LL_WARNS("Voice") << "Wrong account name! " << account_name
+ << " instead of " << mAccountName << LL_ENDL;
+ }
+ else
+ {
+ mAccountPassword = password;
+ }
+
+ std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
+
+ if( !debugSIPURIHostName.empty() )
+ {
+ mVoiceSIPURIHostName = debugSIPURIHostName;
+ }
+
+ if( mVoiceSIPURIHostName.empty() )
+ {
+ // we have an empty account server name
+ // so we fall back to hardcoded defaults
+
+ if(LLGridManager::getInstance()->isInProductionGrid())
+ {
+ // Use the release account server
+ mVoiceSIPURIHostName = "bhr.vivox.com";
+ }
+ else
+ {
+ // Use the development account server
+ mVoiceSIPURIHostName = "bhd.vivox.com";
+ }
+ }
+
+ std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
+
+ if( !debugAccountServerURI.empty() )
+ {
+ mVoiceAccountServerURI = debugAccountServerURI;
+ }
+
+ if( mVoiceAccountServerURI.empty() )
+ {
+ // If the account server URI isn't specified, construct it from the SIP URI hostname
+ mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";
+ }
+}
+
+void LLVivoxVoiceClient::idle(void* user_data)
+{
+ LLVivoxVoiceClient* self = (LLVivoxVoiceClient*)user_data;
+ self->stateMachine();
+}
+
+std::string LLVivoxVoiceClient::state2string(LLVivoxVoiceClient::state inState)
+{
+ std::string result = "UNKNOWN";
+
+ // Prevent copy-paste errors when updating this list...
+#define CASE(x) case x: result = #x; break
+
+ switch(inState)
+ {
+ CASE(stateDisableCleanup);
+ CASE(stateDisabled);
+ CASE(stateStart);
+ CASE(stateDaemonLaunched);
+ CASE(stateConnecting);
+ CASE(stateConnected);
+ CASE(stateIdle);
+ CASE(stateMicTuningStart);
+ CASE(stateMicTuningRunning);
+ CASE(stateMicTuningStop);
+ CASE(stateConnectorStart);
+ CASE(stateConnectorStarting);
+ CASE(stateConnectorStarted);
+ CASE(stateLoginRetry);
+ CASE(stateLoginRetryWait);
+ CASE(stateNeedsLogin);
+ CASE(stateLoggingIn);
+ CASE(stateLoggedIn);
+ CASE(stateCreatingSessionGroup);
+ CASE(stateNoChannel);
+ CASE(stateJoiningSession);
+ CASE(stateSessionJoined);
+ CASE(stateRunning);
+ CASE(stateLeavingSession);
+ CASE(stateSessionTerminated);
+ CASE(stateLoggingOut);
+ CASE(stateLoggedOut);
+ CASE(stateConnectorStopping);
+ CASE(stateConnectorStopped);
+ CASE(stateConnectorFailed);
+ CASE(stateConnectorFailedWaiting);
+ CASE(stateLoginFailed);
+ CASE(stateLoginFailedWaiting);
+ CASE(stateJoinSessionFailed);
+ CASE(stateJoinSessionFailedWaiting);
+ CASE(stateJail);
+ }
+
+#undef CASE
+
+ return result;
+}
+
+
+
+void LLVivoxVoiceClient::setState(state inState)
+{
+ LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
+
+ mState = inState;
+}
+
+void LLVivoxVoiceClient::stateMachine()
+{
+ if(gDisconnected)
+ {
+ // The viewer has been disconnected from the sim. Disable voice.
+ setVoiceEnabled(false);
+ }
+
+ if(mVoiceEnabled)
+ {
+ updatePosition();
+ }
+ else if(mTuningMode)
+ {
+ // Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
+ }
+ else
+ {
+ if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
+ {
+ // User turned off voice support. Send the cleanup messages, close the socket, and reset.
+ if(!mConnected)
+ {
+ // if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
+ LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
+ killGateway();
+ }
+
+ logout();
+ connectorShutdown();
+
+ setState(stateDisableCleanup);
+ }
+ }
+
+ // Check for parcel boundary crossing
+ {
+ LLViewerRegion *region = gAgent.getRegion();
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+
+ if(region && parcel)
+ {
+ S32 parcelLocalID = parcel->getLocalID();
+ std::string regionName = region->getName();
+ std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
+
+// LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
+
+ // The region name starts out empty and gets filled in later.
+ // Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
+ // If either is empty, wait for the next time around.
+ if(!regionName.empty())
+ {
+ if(!capURI.empty())
+ {
+ if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
+ {
+ // We have changed parcels. Initiate a parcel channel lookup.
+ mCurrentParcelLocalID = parcelLocalID;
+ mCurrentRegionName = regionName;
+
+ parcelChanged();
+ }
+ }
+ else
+ {
+ LL_WARNS_ONCE("Voice") << "region doesn't have ParcelVoiceInfoRequest capability. This is normal for a short time after teleporting, but bad if it persists for very long." << LL_ENDL;
+ }
+ }
+ }
+ }
+
+ switch(getState())
+ {
+ //MARK: stateDisableCleanup
+ case stateDisableCleanup:
+ // Clean up and reset everything.
+ closeSocket();
+ deleteAllSessions();
+ deleteAllBuddies();
+
+ mConnectorHandle.clear();
+ mAccountHandle.clear();
+ mAccountPassword.clear();
+ mVoiceAccountServerURI.clear();
+
+ setState(stateDisabled);
+ break;
+
+ //MARK: stateDisabled
+ case stateDisabled:
+ if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
+ {
+ setState(stateStart);
+ }
+ break;
+
+ //MARK: stateStart
+ case stateStart:
+ if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
+ {
+ // Voice is locked out, we must not launch the vivox daemon.
+ setState(stateJail);
+ }
+ else if(!isGatewayRunning())
+ {
+ if(true)
+ {
+ // Launch the voice daemon
+
+ // *FIX:Mani - Using the executable dir instead
+ // of mAppRODataDir, the working directory from which the app
+ // is launched.
+ //std::string exe_path = gDirUtilp->getAppRODataDir();
+ std::string exe_path = gDirUtilp->getExecutableDir();
+ exe_path += gDirUtilp->getDirDelimiter();
+#if LL_WINDOWS
+ exe_path += "SLVoice.exe";
+#elif LL_DARWIN
+ exe_path += "../Resources/SLVoice";
+#else
+ exe_path += "SLVoice";
+#endif
+ // See if the vivox executable exists
+ llstat s;
+ if(!LLFile::stat(exe_path, &s))
+ {
+ // vivox executable exists. Build the command line and launch the daemon.
+ // SLIM SDK: these arguments are no longer necessary.
+// std::string args = " -p tcp -h -c";
+ std::string args;
+ std::string cmd;
+ std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
+
+ if(loglevel.empty())
+ {
+ loglevel = "-1"; // turn logging off completely
+ }
+
+ args += " -ll ";
+ args += loglevel;
+
+ LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
+
+#if LL_WINDOWS
+ PROCESS_INFORMATION pinfo;
+ STARTUPINFOA sinfo;
+
+ memset(&sinfo, 0, sizeof(sinfo));
+
+ std::string exe_dir = gDirUtilp->getAppRODataDir();
+ cmd = "SLVoice.exe";
+ cmd += args;
+
+ // So retarded. Windows requires that the second parameter to CreateProcessA be writable (non-const) string...
+ char *args2 = new char[args.size() + 1];
+ strcpy(args2, args.c_str());
+ if(!CreateProcessA(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, exe_dir.c_str(), &sinfo, &pinfo))
+ {
+// DWORD dwErr = GetLastError();
+ }
+ else
+ {
+ // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on
+ // CloseHandle(pinfo.hProcess); // stops leaks - nothing else
+ sGatewayHandle = pinfo.hProcess;
+ CloseHandle(pinfo.hThread); // stops leaks - nothing else
+ }
+
+ delete[] args2;
+#else // LL_WINDOWS
+ // This should be the same for mac and linux
+ {
+ std::vector<std::string> arglist;
+ arglist.push_back(exe_path);
+
+ // Split the argument string into separate strings for each argument
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep(" ");
+ tokenizer tokens(args, sep);
+ tokenizer::iterator token_iter;
+
+ for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+ {
+ arglist.push_back(*token_iter);
+ }
+
+ // create an argv vector for the child process
+ char **fakeargv = new char*[arglist.size() + 1];
+ int i;
+ for(i=0; i < arglist.size(); i++)
+ fakeargv[i] = const_cast<char*>(arglist[i].c_str());
+
+ fakeargv[i] = NULL;
+
+ fflush(NULL); // flush all buffers before the child inherits them
+ pid_t id = vfork();
+ if(id == 0)
+ {
+ // child
+ execv(exe_path.c_str(), fakeargv);
+
+ // If we reach this point, the exec failed.
+ // Use _exit() instead of exit() per the vfork man page.
+ _exit(0);
+ }
+
+ // parent
+ delete[] fakeargv;
+ sGatewayPID = id;
+ }
+#endif // LL_WINDOWS
+ mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost").c_str(), gSavedSettings.getU32("VivoxVoicePort"));
+ }
+ else
+ {
+ LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
+ }
+ }
+ else
+ {
+ // SLIM SDK: port changed from 44124 to 44125.
+ // We can connect to a client gateway running on another host. This is useful for testing.
+ // To do this, launch the gateway on a nearby host like this:
+ // vivox-gw.exe -p tcp -i 0.0.0.0:44125
+ // and put that host's IP address here.
+ mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost"), gSavedSettings.getU32("VivoxVoicePort"));
+ }
+
+ mUpdateTimer.start();
+ mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+ setState(stateDaemonLaunched);
+
+ // Dirty the states we'll need to sync with the daemon when it comes up.
+ mPTTDirty = true;
+ mMicVolumeDirty = true;
+ mSpeakerVolumeDirty = true;
+ mSpeakerMuteDirty = true;
+ // These only need to be set if they're not default (i.e. empty string).
+ mCaptureDeviceDirty = !mCaptureDevice.empty();
+ mRenderDeviceDirty = !mRenderDevice.empty();
+
+ mMainSessionGroupHandle.clear();
+ }
+ break;
+
+ //MARK: stateDaemonLaunched
+ case stateDaemonLaunched:
+ if(mUpdateTimer.hasExpired())
+ {
+ LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL;
+
+ mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+ if(!mSocket)
+ {
+ mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);
+ }
+
+ mConnected = mSocket->blockingConnect(mDaemonHost);
+ if(mConnected)
+ {
+ setState(stateConnecting);
+ }
+ else
+ {
+ // If the connect failed, the socket may have been put into a bad state. Delete it.
+ closeSocket();
+ }
+ }
+ break;
+
+ //MARK: stateConnecting
+ case stateConnecting:
+ // Can't do this until we have the pump available.
+ if(mPump)
+ {
+ // MBW -- Note to self: pumps and pipes examples in
+ // indra/test/io.cpp
+ // indra/test/llpipeutil.{cpp|h}
+
+ // Attach the pumps and pipes
+
+ LLPumpIO::chain_t readChain;
+
+ readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));
+ readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser()));
+
+ mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
+
+ setState(stateConnected);
+ }
+
+ break;
+
+ //MARK: stateConnected
+ case stateConnected:
+ // Initial devices query
+ getCaptureDevicesSendMessage();
+ getRenderDevicesSendMessage();
+
+ mLoginRetryCount = 0;
+
+ setState(stateIdle);
+ break;
+
+ //MARK: stateIdle
+ case stateIdle:
+ // This is the idle state where we're connected to the daemon but haven't set up a connector yet.
+ if(mTuningMode)
+ {
+ mTuningExitState = stateIdle;
+ setState(stateMicTuningStart);
+ }
+ else if(!mVoiceEnabled)
+ {
+ // We never started up the connector. This will shut down the daemon.
+ setState(stateConnectorStopped);
+ }
+ else if(!mAccountName.empty())
+ {
+ LLViewerRegion *region = gAgent.getRegion();
+
+ if(region)
+ {
+ if ( region->getCapability("ProvisionVoiceAccountRequest") != "" )
+ {
+ if ( mAccountPassword.empty() )
+ {
+ requestVoiceAccountProvision();
+ }
+ setState(stateConnectorStart);
+ }
+ else
+ {
+ LL_WARNS_ONCE("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL;
+ }
+ }
+ }
+ break;
+
+ //MARK: stateMicTuningStart
+ case stateMicTuningStart:
+ if(mUpdateTimer.hasExpired())
+ {
+ if(mCaptureDeviceDirty || mRenderDeviceDirty)
+ {
+ // These can't be changed while in tuning mode. Set them before starting.
+ std::ostringstream stream;
+
+ buildSetCaptureDevice(stream);
+ buildSetRenderDevice(stream);
+
+ if(!stream.str().empty())
+ {
+ writeString(stream.str());
+ }
+
+ // This will come around again in the same state and start the capture, after the timer expires.
+ mUpdateTimer.start();
+ mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+ }
+ else
+ {
+ // duration parameter is currently unused, per Mike S.
+ tuningCaptureStartSendMessage(10000);
+
+ setState(stateMicTuningRunning);
+ }
+ }
+
+ break;
+
+ //MARK: stateMicTuningRunning
+ case stateMicTuningRunning:
+ if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
+ {
+ // All of these conditions make us leave tuning mode.
+ setState(stateMicTuningStop);
+ }
+ else
+ {
+ // process mic/speaker volume changes
+ if(mTuningMicVolumeDirty || mTuningSpeakerVolumeDirty)
+ {
+ std::ostringstream stream;
+
+ if(mTuningMicVolumeDirty)
+ {
+ LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
+ << "<Level>" << mTuningMicVolume << "</Level>"
+ << "</Request>\n\n\n";
+ }
+
+ if(mTuningSpeakerVolumeDirty)
+ {
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
+ << "<Level>" << mTuningSpeakerVolume << "</Level>"
+ << "</Request>\n\n\n";
+ }
+
+ mTuningMicVolumeDirty = false;
+ mTuningSpeakerVolumeDirty = false;
+
+ if(!stream.str().empty())
+ {
+ writeString(stream.str());
+ }
+ }
+ }
+ break;
+
+ //MARK: stateMicTuningStop
+ case stateMicTuningStop:
+ {
+ // transition out of mic tuning
+ tuningCaptureStopSendMessage();
+
+ setState(mTuningExitState);
+
+ // if we exited just to change devices, this will keep us from re-entering too fast.
+ mUpdateTimer.start();
+ mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+
+ }
+ break;
+
+ //MARK: stateConnectorStart
+ case stateConnectorStart:
+ if(!mVoiceEnabled)
+ {
+ // We were never logged in. This will shut down the connector.
+ setState(stateLoggedOut);
+ }
+ else if(!mVoiceAccountServerURI.empty())
+ {
+ connectorCreate();
+ }
+ break;
+
+ //MARK: stateConnectorStarting
+ case stateConnectorStarting: // waiting for connector handle
+ // connectorCreateResponse() will transition from here to stateConnectorStarted.
+ break;
+
+ //MARK: stateConnectorStarted
+ case stateConnectorStarted: // connector handle received
+ if(!mVoiceEnabled)
+ {
+ // We were never logged in. This will shut down the connector.
+ setState(stateLoggedOut);
+ }
+ else
+ {
+ // The connector is started. Send a login message.
+ setState(stateNeedsLogin);
+ }
+ break;
+
+ //MARK: stateLoginRetry
+ case stateLoginRetry:
+ if(mLoginRetryCount == 0)
+ {
+ // First retry -- display a message to the user
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGIN_RETRY);
+ }
+
+ mLoginRetryCount++;
+
+ if(mLoginRetryCount > MAX_LOGIN_RETRIES)
+ {
+ LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
+ setState(stateLoginFailed);
+ LLSD args;
+ std::stringstream errs;
+ errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
+ args["HOSTID"] = errs.str();
+ if (LLGridManager::getInstance()->isSystemGrid())
+ {
+ LLNotificationsUtil::add("NoVoiceConnect", args);
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoVoiceConnect-GIAB", args);
+ }
+ }
+ else
+ {
+ LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
+ mUpdateTimer.start();
+ mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
+ setState(stateLoginRetryWait);
+ }
+ break;
+
+ //MARK: stateLoginRetryWait
+ case stateLoginRetryWait:
+ if(mUpdateTimer.hasExpired())
+ {
+ setState(stateNeedsLogin);
+ }
+ break;
+
+ //MARK: stateNeedsLogin
+ case stateNeedsLogin:
+ if(!mAccountPassword.empty())
+ {
+ setState(stateLoggingIn);
+ loginSendMessage();
+ }
+ break;
+
+ //MARK: stateLoggingIn
+ case stateLoggingIn: // waiting for account handle
+ // loginResponse() will transition from here to stateLoggedIn.
+ break;
+
+ //MARK: stateLoggedIn
+ case stateLoggedIn: // account handle received
+
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
+
+ // request the current set of block rules (we'll need them when updating the friends list)
+ accountListBlockRulesSendMessage();
+
+ // request the current set of auto-accept rules
+ accountListAutoAcceptRulesSendMessage();
+
+ // Set up the mute list observer if it hasn't been set up already.
+ if((!sMuteListListener_listening))
+ {
+ LLMuteList::getInstance()->addObserver(&mutelist_listener);
+ sMuteListListener_listening = true;
+ }
+
+ // Set up the friends list observer if it hasn't been set up already.
+ if(friendslist_listener == NULL)
+ {
+ friendslist_listener = new LLVivoxVoiceClientFriendsObserver;
+ LLAvatarTracker::instance().addObserver(friendslist_listener);
+ }
+
+ // Set the initial state of mic mute, local speaker volume, etc.
+ {
+ std::ostringstream stream;
+
+ buildLocalAudioUpdates(stream);
+
+ if(!stream.str().empty())
+ {
+ writeString(stream.str());
+ }
+ }
+
+#if USE_SESSION_GROUPS
+ // create the main session group
+ sessionGroupCreateSendMessage();
+
+ setState(stateCreatingSessionGroup);
+#else
+ // Not using session groups -- skip the stateCreatingSessionGroup state.
+ setState(stateNoChannel);
+
+ // Initial kick-off of channel lookup logic
+ parcelChanged();
+#endif
+ break;
+
+ //MARK: stateCreatingSessionGroup
+ case stateCreatingSessionGroup:
+ if(mSessionTerminateRequested || !mVoiceEnabled)
+ {
+ // *TODO: Question: is this the right way out of this state
+ setState(stateSessionTerminated);
+ }
+ else if(!mMainSessionGroupHandle.empty())
+ {
+ setState(stateNoChannel);
+
+ // Start looped recording (needed for "panic button" anti-griefing tool)
+ recordingLoopStart();
+
+ // Initial kick-off of channel lookup logic
+ parcelChanged();
+ }
+ break;
+
+ //MARK: stateNoChannel
+ case stateNoChannel:
+
+ LL_DEBUGS("Voice") << "State No Channel" << LL_ENDL;
+ mSpatialJoiningNum = 0;
+ // Do this here as well as inside sendPositionalUpdate().
+ // Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync.
+ sendFriendsListUpdates();
+
+ if(mSessionTerminateRequested || !mVoiceEnabled)
+ {
+ // TODO: Question: Is this the right way out of this state?
+ setState(stateSessionTerminated);
+ }
+ else if(mTuningMode)
+ {
+ mTuningExitState = stateNoChannel;
+ setState(stateMicTuningStart);
+ }
+ else if(sessionNeedsRelog(mNextAudioSession))
+ {
+ requestRelog();
+ setState(stateSessionTerminated);
+ }
+ else if(mNextAudioSession)
+ {
+ sessionState *oldSession = mAudioSession;
+
+ mAudioSession = mNextAudioSession;
+ if(!mAudioSession->mReconnect)
+ {
+ mNextAudioSession = NULL;
+ }
+
+ // The old session may now need to be deleted.
+ reapSession(oldSession);
+
+ if(!mAudioSession->mHandle.empty())
+ {
+ // Connect to a session by session handle
+
+ sessionMediaConnectSendMessage(mAudioSession);
+ }
+ else
+ {
+ // Connect to a session by URI
+ sessionCreateSendMessage(mAudioSession, true, false);
+ }
+
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINING);
+ setState(stateJoiningSession);
+ }
+ else if(!mSpatialSessionURI.empty())
+ {
+ // If we're not headed elsewhere and have a spatial URI, return to spatial.
+ switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+ }
+ break;
+
+ //MARK: stateJoiningSession
+ case stateJoiningSession: // waiting for session handle
+
+ // If this is true we have problem with connection to voice server (EXT-4313).
+ // See descriptions of mSpatialJoiningNum and MAX_NORMAL_JOINING_SPATIAL_NUM.
+ if(mSpatialJoiningNum == MAX_NORMAL_JOINING_SPATIAL_NUM)
+ {
+ // Notify observers to let them know there is problem with voice
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+ llwarns << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << llendl;
+ }
+
+ // Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for
+ // example for p2p many times while waiting for response, so it can't be used to detect errors
+ if(mAudioSession && mAudioSession->mIsSpatial)
+ {
+ mSpatialJoiningNum++;
+ }
+
+ // joinedAudioSession() will transition from here to stateSessionJoined.
+ if(!mVoiceEnabled)
+ {
+ // User bailed out during connect -- jump straight to teardown.
+ setState(stateSessionTerminated);
+ }
+ else if(mSessionTerminateRequested)
+ {
+ if(mAudioSession && !mAudioSession->mHandle.empty())
+ {
+ // Only allow direct exits from this state in p2p calls (for cancelling an invite).
+ // Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+ if(mAudioSession->mIsP2P)
+ {
+ sessionMediaDisconnectSendMessage(mAudioSession);
+ setState(stateSessionTerminated);
+ }
+ }
+ }
+ break;
+
+ //MARK: stateSessionJoined
+ case stateSessionJoined: // session handle received
+
+ mSpatialJoiningNum = 0;
+ // It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4
+ // before continuing from this state. They can happen in either order, and if I don't wait for both, things can get stuck.
+ // For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined.
+ // This is a cheap way to make sure both have happened before proceeding.
+ if(mAudioSession && mAudioSession->mVoiceEnabled)
+ {
+ // Dirty state that may need to be sync'ed with the daemon.
+ mPTTDirty = true;
+ mSpeakerVolumeDirty = true;
+ mSpatialCoordsDirty = true;
+
+ setState(stateRunning);
+
+ // Start the throttle timer
+ mUpdateTimer.start();
+ mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+
+ // Events that need to happen when a session is joined could go here.
+ // Maybe send initial spatial data?
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
+
+ }
+ else if(!mVoiceEnabled)
+ {
+ // User bailed out during connect -- jump straight to teardown.
+ setState(stateSessionTerminated);
+ }
+ else if(mSessionTerminateRequested)
+ {
+ // Only allow direct exits from this state in p2p calls (for cancelling an invite).
+ // Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+ if(mAudioSession && mAudioSession->mIsP2P)
+ {
+ sessionMediaDisconnectSendMessage(mAudioSession);
+ setState(stateSessionTerminated);
+ }
+ }
+ break;
+
+ //MARK: stateRunning
+ case stateRunning: // steady state
+ // Disabling voice or disconnect requested.
+ if(!mVoiceEnabled || mSessionTerminateRequested)
+ {
+ leaveAudioSession();
+ }
+ else
+ {
+
+ // Figure out whether the PTT state needs to change
+ {
+ bool newPTT;
+ if(mUsePTT)
+ {
+ // If configured to use PTT, track the user state.
+ newPTT = mUserPTTState;
+ }
+ else
+ {
+ // If not configured to use PTT, it should always be true (otherwise the user will be unable to speak).
+ newPTT = true;
+ }
+
+ if(mMuteMic)
+ {
+ // This always overrides any other PTT setting.
+ newPTT = false;
+ }
+
+ // Dirty if state changed.
+ if(newPTT != mPTT)
+ {
+ mPTT = newPTT;
+ mPTTDirty = true;
+ }
+ }
+
+ if(!inSpatialChannel())
+ {
+ // When in a non-spatial channel, never send positional updates.
+ mSpatialCoordsDirty = false;
+ }
+ else
+ {
+ // Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position)
+ enforceTether();
+ }
+
+ // Send an update only if the ptt or mute state has changed (which shouldn't be able to happen that often
+ // -- the user can only click so fast) or every 10hz, whichever is sooner.
+ // Sending for every volume update causes an excessive flood of messages whenever a volume slider is dragged.
+ if((mAudioSession && mAudioSession->mMuteDirty) || mPTTDirty || mUpdateTimer.hasExpired())
+ {
+ mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+ sendPositionalUpdate();
+ }
+ }
+ break;
+
+ //MARK: stateLeavingSession
+ case stateLeavingSession: // waiting for terminate session response
+ // The handler for the Session.Terminate response will transition from here to stateSessionTerminated.
+ break;
+
+ //MARK: stateSessionTerminated
+ case stateSessionTerminated:
+
+ // Must do this first, since it uses mAudioSession.
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
+
+ if(mAudioSession)
+ {
+ sessionState *oldSession = mAudioSession;
+
+ mAudioSession = NULL;
+ // We just notified status observers about this change. Don't do it again.
+ mAudioSessionChanged = false;
+
+ // The old session may now need to be deleted.
+ reapSession(oldSession);
+ }
+ else
+ {
+ LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
+ }
+
+ // Always reset the terminate request flag when we get here.
+ mSessionTerminateRequested = false;
+
+ if(mVoiceEnabled && !mRelogRequested)
+ {
+ // Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
+ setState(stateNoChannel);
+ }
+ else
+ {
+ // Shutting down voice, continue with disconnecting.
+ logout();
+
+ // The state machine will take it from here
+ mRelogRequested = false;
+ }
+
+ break;
+
+ //MARK: stateLoggingOut
+ case stateLoggingOut: // waiting for logout response
+ // The handler for the AccountLoginStateChangeEvent will transition from here to stateLoggedOut.
+ break;
+
+ //MARK: stateLoggedOut
+ case stateLoggedOut: // logout response received
+
+ // Once we're logged out, all these things are invalid.
+ mAccountHandle.clear();
+ deleteAllSessions();
+ deleteAllBuddies();
+
+ if(mVoiceEnabled && !mRelogRequested)
+ {
+ // User was logged out, but wants to be logged in. Send a new login request.
+ setState(stateNeedsLogin);
+ }
+ else
+ {
+ // shut down the connector
+ connectorShutdown();
+ }
+ break;
+
+ //MARK: stateConnectorStopping
+ case stateConnectorStopping: // waiting for connector stop
+ // The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped.
+ break;
+
+ //MARK: stateConnectorStopped
+ case stateConnectorStopped: // connector stop received
+ setState(stateDisableCleanup);
+ break;
+
+ //MARK: stateConnectorFailed
+ case stateConnectorFailed:
+ setState(stateConnectorFailedWaiting);
+ break;
+ //MARK: stateConnectorFailedWaiting
+ case stateConnectorFailedWaiting:
+ if(!mVoiceEnabled)
+ {
+ setState(stateDisableCleanup);
+ }
+ break;
+
+ //MARK: stateLoginFailed
+ case stateLoginFailed:
+ setState(stateLoginFailedWaiting);
+ break;
+ //MARK: stateLoginFailedWaiting
+ case stateLoginFailedWaiting:
+ if(!mVoiceEnabled)
+ {
+ setState(stateDisableCleanup);
+ }
+ break;
+
+ //MARK: stateJoinSessionFailed
+ case stateJoinSessionFailed:
+ // Transition to error state. Send out any notifications here.
+ if(mAudioSession)
+ {
+ LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mAudioSession->mErrorStatusCode << "): " << mAudioSession->mErrorStatusString << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Voice") << "stateJoinSessionFailed with no current session" << LL_ENDL;
+ }
+
+ notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
+ setState(stateJoinSessionFailedWaiting);
+ break;
+
+ //MARK: stateJoinSessionFailedWaiting
+ case stateJoinSessionFailedWaiting:
+ // Joining a channel failed, either due to a failed channel name -> sip url lookup or an error from the join message.
+ // Region crossings may leave this state and try the join again.
+ if(mSessionTerminateRequested)
+ {
+ setState(stateSessionTerminated);
+ }
+ break;
+
+ //MARK: stateJail
+ case stateJail:
+ // We have given up. Do nothing.
+ break;
+
+ }
+
+ if(mAudioSession && mAudioSession->mParticipantsChanged)
+ {
+ mAudioSession->mParticipantsChanged = false;
+ mAudioSessionChanged = true;
+ }
+
+ if(mAudioSessionChanged)
+ {
+ mAudioSessionChanged = false;
+ notifyParticipantObservers();
+ }
+}
+
+void LLVivoxVoiceClient::closeSocket(void)
+{
+ mSocket.reset();
+ mConnected = false;
+}
+
+void LLVivoxVoiceClient::loginSendMessage()
+{
+ std::ostringstream stream;
+
+ bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
+ << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+ << "<AccountName>" << mAccountName << "</AccountName>"
+ << "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
+ << "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
+ << "<EnableBuddiesAndPresence>true</EnableBuddiesAndPresence>"
+ << "<BuddyManagementMode>Application</BuddyManagementMode>"
+ << "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
+ << (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::logout()
+{
+ // Ensure that we'll re-request provisioning before logging in again
+ mAccountPassword.clear();
+ mVoiceAccountServerURI.clear();
+
+ setState(stateLoggingOut);
+ logoutSendMessage();
+}
+
+void LLVivoxVoiceClient::logoutSendMessage()
+{
+ if(!mAccountHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
+
+ mAccountHandle.clear();
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::accountListBlockRulesSendMessage()
+{
+ if(!mAccountHandle.empty())
+ {
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "requesting block rules" << LL_ENDL;
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListBlockRules.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::accountListAutoAcceptRulesSendMessage()
+{
+ if(!mAccountHandle.empty())
+ {
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "requesting auto-accept rules" << LL_ENDL;
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListAutoAcceptRules.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::sessionGroupCreateSendMessage()
+{
+ if(!mAccountHandle.empty())
+ {
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<Type>Normal</Type>"
+ << "</Request>"
+ << "\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+ LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+
+ session->mCreateInProgress = true;
+ if(startAudio)
+ {
+ session->mMediaConnectInProgress = true;
+ }
+
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<URI>" << session->mSIPURI << "</URI>";
+
+ static const std::string allowed_chars =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "-._~";
+
+ if(!session->mHash.empty())
+ {
+ stream
+ << "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
+ << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
+ }
+
+ stream
+ << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+ << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+ << "<Name>" << mChannelName << "</Name>"
+ << "</Request>\n\n\n";
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+ LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+
+ session->mCreateInProgress = true;
+ if(startAudio)
+ {
+ session->mMediaConnectInProgress = true;
+ }
+
+ std::string password;
+ if(!session->mHash.empty())
+ {
+ static const std::string allowed_chars =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "-._~"
+ ;
+ password = LLURI::escape(session->mHash, allowed_chars);
+ }
+
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<URI>" << session->mSIPURI << "</URI>"
+ << "<Name>" << mChannelName << "</Name>"
+ << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+ << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+ << "<Password>" << password << "</Password>"
+ << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
+ << "</Request>\n\n\n"
+ ;
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionMediaConnectSendMessage(sessionState *session)
+{
+ LL_DEBUGS("Voice") << "connecting audio to session handle: " << session->mHandle << LL_ENDL;
+
+ session->mMediaConnectInProgress = true;
+
+ std::ostringstream stream;
+
+ stream
+ << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "<Media>Audio</Media>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionTextConnectSendMessage(sessionState *session)
+{
+ LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
+
+ std::ostringstream stream;
+
+ stream
+ << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionTerminate()
+{
+ mSessionTerminateRequested = true;
+}
+
+void LLVivoxVoiceClient::requestRelog()
+{
+ mSessionTerminateRequested = true;
+ mRelogRequested = true;
+}
+
+
+void LLVivoxVoiceClient::leaveAudioSession()
+{
+ if(mAudioSession)
+ {
+ LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
+
+ switch(getState())
+ {
+ case stateNoChannel:
+ // In this case, we want to pretend the join failed so our state machine doesn't get stuck.
+ // Skip the join failed transition state so we don't send out error notifications.
+ setState(stateJoinSessionFailedWaiting);
+ break;
+ case stateJoiningSession:
+ case stateSessionJoined:
+ case stateRunning:
+ if(!mAudioSession->mHandle.empty())
+ {
+
+#if RECORD_EVERYTHING
+ // HACK: for testing only
+ // Save looped recording
+ std::string savepath("/tmp/vivoxrecording");
+ {
+ time_t now = time(NULL);
+ const size_t BUF_SIZE = 64;
+ char time_str[BUF_SIZE]; /* Flawfinder: ignore */
+
+ strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
+ savepath += time_str;
+ }
+ recordingLoopSave(savepath);
+#endif
+
+ sessionMediaDisconnectSendMessage(mAudioSession);
+ setState(stateLeavingSession);
+ }
+ else
+ {
+ LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;
+ setState(stateSessionTerminated);
+ }
+ break;
+ case stateJoinSessionFailed:
+ case stateJoinSessionFailedWaiting:
+ setState(stateSessionTerminated);
+ break;
+
+ default:
+ LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
+ break;
+ }
+ }
+ else
+ {
+ LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
+ setState(stateSessionTerminated);
+ }
+}
+
+void LLVivoxVoiceClient::sessionTerminateSendMessage(sessionState *session)
+{
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionGroupTerminateSendMessage(sessionState *session)
+{
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session)
+{
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "<Media>Audio</Media>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+
+}
+
+void LLVivoxVoiceClient::sessionTextDisconnectSendMessage(sessionState *session)
+{
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.TextDisconnect.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::getCaptureDevicesSendMessage()
+{
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::getRenderDevicesSendMessage()
+{
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::clearCaptureDevices()
+{
+ LL_DEBUGS("Voice") << "called" << LL_ENDL;
+ mCaptureDevices.clear();
+}
+
+void LLVivoxVoiceClient::addCaptureDevice(const std::string& name)
+{
+ LL_DEBUGS("Voice") << name << LL_ENDL;
+
+ mCaptureDevices.push_back(name);
+}
+
+LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices()
+{
+ return mCaptureDevices;
+}
+
+void LLVivoxVoiceClient::setCaptureDevice(const std::string& name)
+{
+ if(name == "Default")
+ {
+ if(!mCaptureDevice.empty())
+ {
+ mCaptureDevice.clear();
+ mCaptureDeviceDirty = true;
+ }
+ }
+ else
+ {
+ if(mCaptureDevice != name)
+ {
+ mCaptureDevice = name;
+ mCaptureDeviceDirty = true;
+ }
+ }
+}
+
+void LLVivoxVoiceClient::clearRenderDevices()
+{
+ LL_DEBUGS("Voice") << "called" << LL_ENDL;
+ mRenderDevices.clear();
+}
+
+void LLVivoxVoiceClient::addRenderDevice(const std::string& name)
+{
+ LL_DEBUGS("Voice") << name << LL_ENDL;
+ mRenderDevices.push_back(name);
+}
+
+LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices()
+{
+ return mRenderDevices;
+}
+
+void LLVivoxVoiceClient::setRenderDevice(const std::string& name)
+{
+ if(name == "Default")
+ {
+ if(!mRenderDevice.empty())
+ {
+ mRenderDevice.clear();
+ mRenderDeviceDirty = true;
+ }
+ }
+ else
+ {
+ if(mRenderDevice != name)
+ {
+ mRenderDevice = name;
+ mRenderDeviceDirty = true;
+ }
+ }
+
+}
+
+void LLVivoxVoiceClient::tuningStart()
+{
+ mTuningMode = true;
+ LL_DEBUGS("Voice") << "Starting tuning" << LL_ENDL;
+ if(getState() >= stateNoChannel)
+ {
+ LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
+ sessionTerminate();
+ }
+}
+
+void LLVivoxVoiceClient::tuningStop()
+{
+ mTuningMode = false;
+}
+
+bool LLVivoxVoiceClient::inTuningMode()
+{
+ bool result = false;
+ switch(getState())
+ {
+ case stateMicTuningRunning:
+ result = true;
+ break;
+ default:
+ break;
+ }
+ return result;
+}
+
+void LLVivoxVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
+{
+ mTuningAudioFile = name;
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
+ << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+ << "<Loop>" << (loop?"1":"0") << "</Loop>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::tuningRenderStopSendMessage()
+{
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
+ << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::tuningCaptureStartSendMessage(int duration)
+{
+ LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
+
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
+ << "<Duration>" << duration << "</Duration>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::tuningCaptureStopSendMessage()
+{
+ LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
+
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+
+ mTuningEnergy = 0.0f;
+}
+
+void LLVivoxVoiceClient::tuningSetMicVolume(float volume)
+{
+ int scaled_volume = scale_mic_volume(volume);
+
+ if(scaled_volume != mTuningMicVolume)
+ {
+ mTuningMicVolume = scaled_volume;
+ mTuningMicVolumeDirty = true;
+ }
+}
+
+void LLVivoxVoiceClient::tuningSetSpeakerVolume(float volume)
+{
+ int scaled_volume = scale_speaker_volume(volume);
+
+ if(scaled_volume != mTuningSpeakerVolume)
+ {
+ mTuningSpeakerVolume = scaled_volume;
+ mTuningSpeakerVolumeDirty = true;
+ }
+}
+
+float LLVivoxVoiceClient::tuningGetEnergy(void)
+{
+ return mTuningEnergy;
+}
+
+bool LLVivoxVoiceClient::deviceSettingsAvailable()
+{
+ bool result = true;
+
+ if(!mConnected)
+ result = false;
+
+ if(mRenderDevices.empty())
+ result = false;
+
+ return result;
+}
+
+void LLVivoxVoiceClient::refreshDeviceLists(bool clearCurrentList)
+{
+ if(clearCurrentList)
+ {
+ clearCaptureDevices();
+ clearRenderDevices();
+ }
+ getCaptureDevicesSendMessage();
+ getRenderDevicesSendMessage();
+}
+
+void LLVivoxVoiceClient::daemonDied()
+{
+ // The daemon died, so the connection is gone. Reset everything and start over.
+ LL_WARNS("Voice") << "Connection to vivox daemon lost. Resetting state."<< LL_ENDL;
+
+ // Try to relaunch the daemon
+ setState(stateDisableCleanup);
+}
+
+void LLVivoxVoiceClient::giveUp()
+{
+ // All has failed. Clean up and stop trying.
+ closeSocket();
+ deleteAllSessions();
+ deleteAllBuddies();
+
+ setState(stateJail);
+}
+
+static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
+{
+ F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the new position and velocity
+ F64 npos[3];
+
+ // The original XML command was sent like this:
+ /*
+ << "<Position>"
+ << "<X>" << pos[VX] << "</X>"
+ << "<Y>" << pos[VZ] << "</Y>"
+ << "<Z>" << pos[VY] << "</Z>"
+ << "</Position>"
+ << "<Velocity>"
+ << "<X>" << mAvatarVelocity[VX] << "</X>"
+ << "<Y>" << mAvatarVelocity[VZ] << "</Y>"
+ << "<Z>" << mAvatarVelocity[VY] << "</Z>"
+ << "</Velocity>"
+ << "<AtOrientation>"
+ << "<X>" << l.mV[VX] << "</X>"
+ << "<Y>" << u.mV[VX] << "</Y>"
+ << "<Z>" << a.mV[VX] << "</Z>"
+ << "</AtOrientation>"
+ << "<UpOrientation>"
+ << "<X>" << l.mV[VZ] << "</X>"
+ << "<Y>" << u.mV[VY] << "</Y>"
+ << "<Z>" << a.mV[VZ] << "</Z>"
+ << "</UpOrientation>"
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VY] << "</X>"
+ << "<Y>" << u.mV [VZ] << "</Y>"
+ << "<Z>" << a.mV [VY] << "</Z>"
+ << "</LeftOrientation>";
+ */
+
+#if 1
+ // This was the original transform done when building the XML command
+ nat[0] = left.mV[VX];
+ nat[1] = up.mV[VX];
+ nat[2] = at.mV[VX];
+
+ nup[0] = left.mV[VZ];
+ nup[1] = up.mV[VY];
+ nup[2] = at.mV[VZ];
+
+ nl[0] = left.mV[VY];
+ nl[1] = up.mV[VZ];
+ nl[2] = at.mV[VY];
+
+ npos[0] = pos.mdV[VX];
+ npos[1] = pos.mdV[VZ];
+ npos[2] = pos.mdV[VY];
+
+ nvel[0] = vel.mV[VX];
+ nvel[1] = vel.mV[VZ];
+ nvel[2] = vel.mV[VY];
+
+ for(int i=0;i<3;++i) {
+ at.mV[i] = nat[i];
+ up.mV[i] = nup[i];
+ left.mV[i] = nl[i];
+ pos.mdV[i] = npos[i];
+ }
+
+ // This was the original transform done in the SDK
+ nat[0] = at.mV[2];
+ nat[1] = 0; // y component of at vector is always 0, this was up[2]
+ nat[2] = -1 * left.mV[2];
+
+ // We override whatever the application gives us
+ nup[0] = 0; // x component of up vector is always 0
+ nup[1] = 1; // y component of up vector is always 1
+ nup[2] = 0; // z component of up vector is always 0
+
+ nl[0] = at.mV[0];
+ nl[1] = 0; // y component of left vector is always zero, this was up[0]
+ nl[2] = -1 * left.mV[0];
+
+ npos[2] = pos.mdV[2] * -1.0;
+ npos[1] = pos.mdV[1];
+ npos[0] = pos.mdV[0];
+
+ for(int i=0;i<3;++i) {
+ at.mV[i] = nat[i];
+ up.mV[i] = nup[i];
+ left.mV[i] = nl[i];
+ pos.mdV[i] = npos[i];
+ }
+#else
+ // This is the compose of the two transforms (at least, that's what I'm trying for)
+ nat[0] = at.mV[VX];
+ nat[1] = 0; // y component of at vector is always 0, this was up[2]
+ nat[2] = -1 * up.mV[VZ];
+
+ // We override whatever the application gives us
+ nup[0] = 0; // x component of up vector is always 0
+ nup[1] = 1; // y component of up vector is always 1
+ nup[2] = 0; // z component of up vector is always 0
+
+ nl[0] = left.mV[VX];
+ nl[1] = 0; // y component of left vector is always zero, this was up[0]
+ nl[2] = -1 * left.mV[VY];
+
+ npos[0] = pos.mdV[VX];
+ npos[1] = pos.mdV[VZ];
+ npos[2] = pos.mdV[VY] * -1.0;
+
+ nvel[0] = vel.mV[VX];
+ nvel[1] = vel.mV[VZ];
+ nvel[2] = vel.mV[VY];
+
+ for(int i=0;i<3;++i) {
+ at.mV[i] = nat[i];
+ up.mV[i] = nup[i];
+ left.mV[i] = nl[i];
+ pos.mdV[i] = npos[i];
+ }
+
+#endif
+}
+
+void LLVivoxVoiceClient::sendPositionalUpdate(void)
+{
+ std::ostringstream stream;
+
+ if(mSpatialCoordsDirty)
+ {
+ LLVector3 l, u, a, vel;
+ LLVector3d pos;
+
+ mSpatialCoordsDirty = false;
+
+ // Always send both speaker and listener positions together.
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"
+ << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
+
+ stream << "<SpeakerPosition>";
+
+// LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
+ l = mAvatarRot.getLeftRow();
+ u = mAvatarRot.getUpRow();
+ a = mAvatarRot.getFwdRow();
+ pos = mAvatarPosition;
+ vel = mAvatarVelocity;
+
+ // SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
+ // The old transform is replicated by this function.
+ oldSDKTransform(l, u, a, pos, vel);
+
+ stream
+ << "<Position>"
+ << "<X>" << pos.mdV[VX] << "</X>"
+ << "<Y>" << pos.mdV[VY] << "</Y>"
+ << "<Z>" << pos.mdV[VZ] << "</Z>"
+ << "</Position>"
+ << "<Velocity>"
+ << "<X>" << vel.mV[VX] << "</X>"
+ << "<Y>" << vel.mV[VY] << "</Y>"
+ << "<Z>" << vel.mV[VZ] << "</Z>"
+ << "</Velocity>"
+ << "<AtOrientation>"
+ << "<X>" << a.mV[VX] << "</X>"
+ << "<Y>" << a.mV[VY] << "</Y>"
+ << "<Z>" << a.mV[VZ] << "</Z>"
+ << "</AtOrientation>"
+ << "<UpOrientation>"
+ << "<X>" << u.mV[VX] << "</X>"
+ << "<Y>" << u.mV[VY] << "</Y>"
+ << "<Z>" << u.mV[VZ] << "</Z>"
+ << "</UpOrientation>"
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VX] << "</X>"
+ << "<Y>" << l.mV [VY] << "</Y>"
+ << "<Z>" << l.mV [VZ] << "</Z>"
+ << "</LeftOrientation>";
+
+ stream << "</SpeakerPosition>";
+
+ stream << "<ListenerPosition>";
+
+ LLVector3d earPosition;
+ LLVector3 earVelocity;
+ LLMatrix3 earRot;
+
+ switch(mEarLocation)
+ {
+ case earLocCamera:
+ default:
+ earPosition = mCameraPosition;
+ earVelocity = mCameraVelocity;
+ earRot = mCameraRot;
+ break;
+
+ case earLocAvatar:
+ earPosition = mAvatarPosition;
+ earVelocity = mAvatarVelocity;
+ earRot = mAvatarRot;
+ break;
+
+ case earLocMixed:
+ earPosition = mAvatarPosition;
+ earVelocity = mAvatarVelocity;
+ earRot = mCameraRot;
+ break;
+ }
+
+ l = earRot.getLeftRow();
+ u = earRot.getUpRow();
+ a = earRot.getFwdRow();
+ pos = earPosition;
+ vel = earVelocity;
+
+// LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
+
+ oldSDKTransform(l, u, a, pos, vel);
+
+ stream
+ << "<Position>"
+ << "<X>" << pos.mdV[VX] << "</X>"
+ << "<Y>" << pos.mdV[VY] << "</Y>"
+ << "<Z>" << pos.mdV[VZ] << "</Z>"
+ << "</Position>"
+ << "<Velocity>"
+ << "<X>" << vel.mV[VX] << "</X>"
+ << "<Y>" << vel.mV[VY] << "</Y>"
+ << "<Z>" << vel.mV[VZ] << "</Z>"
+ << "</Velocity>"
+ << "<AtOrientation>"
+ << "<X>" << a.mV[VX] << "</X>"
+ << "<Y>" << a.mV[VY] << "</Y>"
+ << "<Z>" << a.mV[VZ] << "</Z>"
+ << "</AtOrientation>"
+ << "<UpOrientation>"
+ << "<X>" << u.mV[VX] << "</X>"
+ << "<Y>" << u.mV[VY] << "</Y>"
+ << "<Z>" << u.mV[VZ] << "</Z>"
+ << "</UpOrientation>"
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VX] << "</X>"
+ << "<Y>" << l.mV [VY] << "</Y>"
+ << "<Z>" << l.mV [VZ] << "</Z>"
+ << "</LeftOrientation>";
+
+
+ stream << "</ListenerPosition>";
+
+ stream << "</Request>\n\n\n";
+ }
+
+ if(mAudioSession && (mAudioSession->mVolumeDirty || mAudioSession->mMuteDirty))
+ {
+ participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+
+ mAudioSession->mVolumeDirty = false;
+ mAudioSession->mMuteDirty = false;
+
+ for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+ {
+ participantState *p = iter->second;
+
+ if(p->mVolumeDirty)
+ {
+ // Can't set volume/mute for yourself
+ if(!p->mIsSelf)
+ {
+ // scale from the range 0.0-1.0 to vivox volume in the range 0-100
+ S32 volume = llround(p->mVolume / VOLUME_SCALE_VIVOX);
+ bool mute = p->mOnMuteList;
+
+ if(mute)
+ {
+ // SetParticipantMuteForMe doesn't work in p2p sessions.
+ // If we want the user to be muted, set their volume to 0 as well.
+ // This isn't perfect, but it will at least reduce their volume to a minimum.
+ volume = 0;
+ // Mark the current volume level as set to prevent incoming events
+ // changing it to 0, so that we can return to it when unmuting.
+ p->mVolumeSet = true;
+ }
+
+ if(volume == 0)
+ {
+ mute = true;
+ }
+
+ LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
+
+ // SLIM SDK: Send both volume and mute commands.
+
+ // Send a "volume for me" command for the user.
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
+ << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+ << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+ << "<Volume>" << volume << "</Volume>"
+ << "</Request>\n\n\n";
+
+ if(!mAudioSession->mIsP2P)
+ {
+ // Send a "mute for me" command for the user
+ // Doesn't work in P2P sessions
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
+ << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+ << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+ << "<Mute>" << (mute?"1":"0") << "</Mute>"
+ << "<Scope>Audio</Scope>"
+ << "</Request>\n\n\n";
+ }
+ }
+
+ p->mVolumeDirty = false;
+ }
+ }
+ }
+
+ buildLocalAudioUpdates(stream);
+
+ if(!stream.str().empty())
+ {
+ writeString(stream.str());
+ }
+
+ // Friends list updates can be huge, especially on the first voice login of an account with lots of friends.
+ // Batching them all together can choke SLVoice, so send them in separate writes.
+ sendFriendsListUpdates();
+}
+
+void LLVivoxVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
+{
+ if(mCaptureDeviceDirty)
+ {
+ LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
+ << "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
+ << "</Request>"
+ << "\n\n\n";
+
+ mCaptureDeviceDirty = false;
+ }
+}
+
+void LLVivoxVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
+{
+ if(mRenderDeviceDirty)
+ {
+ LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
+ << "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
+ << "</Request>"
+ << "\n\n\n";
+ mRenderDeviceDirty = false;
+ }
+}
+
+void LLVivoxVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
+{
+ buildSetCaptureDevice(stream);
+
+ buildSetRenderDevice(stream);
+
+ if(mPTTDirty)
+ {
+ mPTTDirty = false;
+
+ // Send a local mute command.
+ // NOTE that the state of "PTT" is the inverse of "local mute".
+ // (i.e. when PTT is true, we send a mute command with "false", and vice versa)
+
+ LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
+
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
+ << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+ << "<Value>" << (mPTT?"false":"true") << "</Value>"
+ << "</Request>\n\n\n";
+
+ }
+
+ if(mSpeakerMuteDirty)
+ {
+ const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0))?"true":"false");
+
+ mSpeakerMuteDirty = false;
+
+ LL_INFOS("Voice") << "Setting speaker mute to " << muteval << LL_ENDL;
+
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
+ << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+ << "<Value>" << muteval << "</Value>"
+ << "</Request>\n\n\n";
+
+ }
+
+ if(mSpeakerVolumeDirty)
+ {
+ mSpeakerVolumeDirty = false;
+
+ LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume << LL_ENDL;
+
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
+ << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+ << "<Value>" << mSpeakerVolume << "</Value>"
+ << "</Request>\n\n\n";
+
+ }
+
+ if(mMicVolumeDirty)
+ {
+ mMicVolumeDirty = false;
+
+ LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume << LL_ENDL;
+
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
+ << "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+ << "<Value>" << mMicVolume << "</Value>"
+ << "</Request>\n\n\n";
+ }
+
+
+}
+
+void LLVivoxVoiceClient::checkFriend(const LLUUID& id)
+{
+ std::string name;
+ buddyListEntry *buddy = findBuddy(id);
+
+ // Make sure we don't add a name before it's been looked up.
+ if(gCacheName->getFullName(id, name))
+ {
+
+ const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
+ bool canSeeMeOnline = false;
+ if(relationInfo && relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS))
+ canSeeMeOnline = true;
+
+ // When we get here, mNeedsSend is true and mInSLFriends is false. Change them as necessary.
+
+ if(buddy)
+ {
+ // This buddy is already in both lists.
+
+ if(name != buddy->mDisplayName)
+ {
+ // The buddy is in the list with the wrong name. Update it with the correct name.
+ LL_WARNS("Voice") << "Buddy " << id << " has wrong name (\"" << buddy->mDisplayName << "\" should be \"" << name << "\"), updating."<< LL_ENDL;
+ buddy->mDisplayName = name;
+ buddy->mNeedsNameUpdate = true; // This will cause the buddy to be resent.
+ }
+ }
+ else
+ {
+ // This buddy was not in the vivox list, needs to be added.
+ buddy = addBuddy(sipURIFromID(id), name);
+ buddy->mUUID = id;
+ }
+
+ // In all the above cases, the buddy is in the SL friends list (which is how we got here).
+ buddy->mInSLFriends = true;
+ buddy->mCanSeeMeOnline = canSeeMeOnline;
+ buddy->mNameResolved = true;
+
+ }
+ else
+ {
+ // This name hasn't been looked up yet. Don't do anything with this buddy list entry until it has.
+ if(buddy)
+ {
+ buddy->mNameResolved = false;
+ }
+
+ // Initiate a lookup.
+ // The "lookup completed" callback will ensure that the friends list is rechecked after it completes.
+ lookupName(id);
+ }
+}
+
+void LLVivoxVoiceClient::clearAllLists()
+{
+ // FOR TESTING ONLY
+
+ // This will send the necessary commands to delete ALL buddies, autoaccept rules, and block rules SLVoice tells us about.
+ buddyListMap::iterator buddy_it;
+ for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+ {
+ buddyListEntry *buddy = buddy_it->second;
+ buddy_it++;
+
+ std::ostringstream stream;
+
+ if(buddy->mInVivoxBuddies)
+ {
+ // delete this entry from the vivox buddy list
+ buddy->mInVivoxBuddies = false;
+ LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+ << "</Request>\n\n\n";
+ }
+
+ if(buddy->mHasBlockListEntry)
+ {
+ // Delete the associated block list entry (so the block list doesn't fill up with junk)
+ buddy->mHasBlockListEntry = false;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BlockMask>" << buddy->mURI << "</BlockMask>"
+ << "</Request>\n\n\n";
+ }
+ if(buddy->mHasAutoAcceptListEntry)
+ {
+ // Delete the associated auto-accept list entry (so the auto-accept list doesn't fill up with junk)
+ buddy->mHasAutoAcceptListEntry = false;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+ << "</Request>\n\n\n";
+ }
+
+ writeString(stream.str());
+
+ }
+}
+
+void LLVivoxVoiceClient::sendFriendsListUpdates()
+{
+ if(mBuddyListMapPopulated && mBlockRulesListReceived && mAutoAcceptRulesListReceived && mFriendsListDirty)
+ {
+ mFriendsListDirty = false;
+
+ if(0)
+ {
+ // FOR TESTING ONLY -- clear all buddy list, block list, and auto-accept list entries.
+ clearAllLists();
+ return;
+ }
+
+ LL_INFOS("Voice") << "Checking vivox buddy list against friends list..." << LL_ENDL;
+
+ buddyListMap::iterator buddy_it;
+ for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+ {
+ // reset the temp flags in the local buddy list
+ buddy_it->second->mInSLFriends = false;
+ }
+
+ // correlate with the friends list
+ {
+ LLCollectAllBuddies collect;
+ LLAvatarTracker::instance().applyFunctor(collect);
+ LLCollectAllBuddies::buddy_map_t::const_iterator it = collect.mOnline.begin();
+ LLCollectAllBuddies::buddy_map_t::const_iterator end = collect.mOnline.end();
+
+ for ( ; it != end; ++it)
+ {
+ checkFriend(it->second);
+ }
+ it = collect.mOffline.begin();
+ end = collect.mOffline.end();
+ for ( ; it != end; ++it)
+ {
+ checkFriend(it->second);
+ }
+ }
+
+ LL_INFOS("Voice") << "Sending friend list updates..." << LL_ENDL;
+
+ for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+ {
+ buddyListEntry *buddy = buddy_it->second;
+ buddy_it++;
+
+ // Ignore entries that aren't resolved yet.
+ if(buddy->mNameResolved)
+ {
+ std::ostringstream stream;
+
+ if(buddy->mInSLFriends && (!buddy->mInVivoxBuddies || buddy->mNeedsNameUpdate))
+ {
+ if(mNumberOfAliases > 0)
+ {
+ // Add (or update) this entry in the vivox buddy list
+ buddy->mInVivoxBuddies = true;
+ buddy->mNeedsNameUpdate = false;
+ LL_DEBUGS("Voice") << "add/update " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+ << "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
+ << "<BuddyData></BuddyData>" // Without this, SLVoice doesn't seem to parse the command.
+ << "<GroupID>0</GroupID>"
+ << "</Request>\n\n\n";
+ }
+ }
+ else if(!buddy->mInSLFriends)
+ {
+ // This entry no longer exists in your SL friends list. Remove all traces of it from the Vivox buddy list.
+ if(buddy->mInVivoxBuddies)
+ {
+ // delete this entry from the vivox buddy list
+ buddy->mInVivoxBuddies = false;
+ LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+ << "</Request>\n\n\n";
+ }
+
+ if(buddy->mHasBlockListEntry)
+ {
+ // Delete the associated block list entry, if any
+ buddy->mHasBlockListEntry = false;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BlockMask>" << buddy->mURI << "</BlockMask>"
+ << "</Request>\n\n\n";
+ }
+ if(buddy->mHasAutoAcceptListEntry)
+ {
+ // Delete the associated auto-accept list entry, if any
+ buddy->mHasAutoAcceptListEntry = false;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+ << "</Request>\n\n\n";
+ }
+ }
+
+ if(buddy->mInSLFriends)
+ {
+
+ if(buddy->mCanSeeMeOnline)
+ {
+ // Buddy should not be blocked.
+
+ // If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+
+ // If the buddy has a block list entry, delete it.
+ if(buddy->mHasBlockListEntry)
+ {
+ buddy->mHasBlockListEntry = false;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BlockMask>" << buddy->mURI << "</BlockMask>"
+ << "</Request>\n\n\n";
+
+
+ // If we just deleted a block list entry, add an auto-accept entry.
+ if(!buddy->mHasAutoAcceptListEntry)
+ {
+ buddy->mHasAutoAcceptListEntry = true;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateAutoAcceptRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+ << "<AutoAddAsBuddy>0</AutoAddAsBuddy>"
+ << "</Request>\n\n\n";
+ }
+ }
+ }
+ else
+ {
+ // Buddy should be blocked.
+
+ // If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+
+ // If this buddy has an autoaccept entry, delete it
+ if(buddy->mHasAutoAcceptListEntry)
+ {
+ buddy->mHasAutoAcceptListEntry = false;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+ << "</Request>\n\n\n";
+
+ // If we just deleted an auto-accept entry, add a block list entry.
+ if(!buddy->mHasBlockListEntry)
+ {
+ buddy->mHasBlockListEntry = true;
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateBlockRule.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BlockMask>" << buddy->mURI << "</BlockMask>"
+ << "<PresenceOnly>1</PresenceOnly>"
+ << "</Request>\n\n\n";
+ }
+ }
+ }
+
+ if(!buddy->mInSLFriends && !buddy->mInVivoxBuddies)
+ {
+ // Delete this entry from the local buddy list. This should NOT invalidate the iterator,
+ // since it has already been incremented to the next entry.
+ deleteBuddy(buddy->mURI);
+ }
+
+ }
+ writeString(stream.str());
+ }
+ }
+ }
+}
+
+/////////////////////////////
+// Response/Event handlers
+
+void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
+{
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
+ setState(stateConnectorFailed);
+ LLSD args;
+ std::stringstream errs;
+ errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
+ args["HOSTID"] = errs.str();
+ if (LLGridManager::getInstance()->isSystemGrid())
+ {
+ LLNotificationsUtil::add("NoVoiceConnect", args);
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoVoiceConnect-GIAB", args);
+ }
+ }
+ else
+ {
+ // Connector created, move forward.
+ LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
+ mVoiceVersion.serverVersion = versionID;
+ mConnectorHandle = connectorHandle;
+ if(getState() == stateConnectorStarting)
+ {
+ setState(stateConnectorStarted);
+ }
+ }
+}
+
+void LLVivoxVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
+{
+ LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
+
+ // Status code of 20200 means "bad password". We may want to special-case that at some point.
+
+ if ( statusCode == 401 )
+ {
+ // Login failure which is probably caused by the delay after a user's password being updated.
+ LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ setState(stateLoginRetry);
+ }
+ else if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ setState(stateLoginFailed);
+ }
+ else
+ {
+ // Login succeeded, move forward.
+ mAccountHandle = accountHandle;
+ mNumberOfAliases = numberOfAliases;
+ // This needs to wait until the AccountLoginStateChangeEvent is received.
+// if(getState() == stateLoggingIn)
+// {
+// setState(stateLoggedIn);
+// }
+ }
+}
+
+void LLVivoxVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{
+ sessionState *session = findSessionBeingCreatedByURI(requestId);
+
+ if(session)
+ {
+ session->mCreateInProgress = false;
+ }
+
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ if(session)
+ {
+ session->mErrorStatusCode = statusCode;
+ session->mErrorStatusString = statusString;
+ if(session == mAudioSession)
+ {
+ setState(stateJoinSessionFailed);
+ }
+ else
+ {
+ reapSession(session);
+ }
+ }
+ }
+ else
+ {
+ LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
+ if(session)
+ {
+ setSessionHandle(session, sessionHandle);
+ }
+ }
+}
+
+void LLVivoxVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{
+ sessionState *session = findSessionBeingCreatedByURI(requestId);
+
+ if(session)
+ {
+ session->mCreateInProgress = false;
+ }
+
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ if(session)
+ {
+ session->mErrorStatusCode = statusCode;
+ session->mErrorStatusString = statusString;
+ if(session == mAudioSession)
+ {
+ setState(stateJoinSessionFailed);
+ }
+ else
+ {
+ reapSession(session);
+ }
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
+ if(session)
+ {
+ setSessionHandle(session, sessionHandle);
+ }
+ }
+}
+
+void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
+{
+ sessionState *session = findSession(requestId);
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ if(session)
+ {
+ session->mMediaConnectInProgress = false;
+ session->mErrorStatusCode = statusCode;
+ session->mErrorStatusString = statusString;
+ if(session == mAudioSession)
+ setState(stateJoinSessionFailed);
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::logoutResponse(int statusCode, std::string &statusString)
+{
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
+ // Should this ever fail? do we care if it does?
+ }
+}
+
+void LLVivoxVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
+{
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
+ // Should this ever fail? do we care if it does?
+ }
+
+ mConnected = false;
+
+ if(getState() == stateConnectorStopping)
+ {
+ setState(stateConnectorStopped);
+ }
+}
+
+void LLVivoxVoiceClient::sessionAddedEvent(
+ std::string &uriString,
+ std::string &alias,
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ bool isChannel,
+ bool incoming,
+ std::string &nameString,
+ std::string &applicationString)
+{
+ sessionState *session = NULL;
+
+ LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
+
+ session = addSession(uriString, sessionHandle);
+ if(session)
+ {
+ session->mGroupHandle = sessionGroupHandle;
+ session->mIsChannel = isChannel;
+ session->mIncoming = incoming;
+ session->mAlias = alias;
+
+ // Generate a caller UUID -- don't need to do this for channels
+ if(!session->mIsChannel)
+ {
+ if(IDFromName(session->mSIPURI, session->mCallerID))
+ {
+ // Normal URI(base64-encoded UUID)
+ }
+ else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
+ {
+ // Wrong URI, but an alias is available. Stash the incoming URI as an alternate
+ session->mAlternateSIPURI = session->mSIPURI;
+
+ // and generate a proper URI from the ID.
+ setSessionURI(session, sipURIFromID(session->mCallerID));
+ }
+ else
+ {
+ LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
+ setUUIDFromStringHash(session->mCallerID, session->mSIPURI);
+ session->mSynthesizedCallerID = true;
+
+ // Can't look up the name in this case -- we have to extract it from the URI.
+ std::string namePortion = nameFromsipURI(session->mSIPURI);
+ if(namePortion.empty())
+ {
+ // Didn't seem to be a SIP URI, just use the whole provided name.
+ namePortion = nameString;
+ }
+
+ // Some incoming names may be separated with an underscore instead of a space. Fix this.
+ LLStringUtil::replaceChar(namePortion, '_', ' ');
+
+ // Act like we just finished resolving the name (this stores it in all the right places)
+ avatarNameResolved(session->mCallerID, namePortion);
+ }
+
+ LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
+
+ if(!session->mSynthesizedCallerID)
+ {
+ // If we got here, we don't have a proper name. Initiate a lookup.
+ lookupName(session->mCallerID);
+ }
+ }
+ }
+}
+
+void LLVivoxVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
+{
+ LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
+
+#if USE_SESSION_GROUPS
+ if(mMainSessionGroupHandle.empty())
+ {
+ // This is the first (i.e. "main") session group. Save its handle.
+ mMainSessionGroupHandle = sessionGroupHandle;
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
+ }
+#endif
+}
+
+void LLVivoxVoiceClient::joinedAudioSession(sessionState *session)
+{
+ LL_DEBUGS("Voice") << "Joined Audio Session" << LL_ENDL;
+ if(mAudioSession != session)
+ {
+ sessionState *oldSession = mAudioSession;
+
+ mAudioSession = session;
+ mAudioSessionChanged = true;
+
+ // The old session may now need to be deleted.
+ reapSession(oldSession);
+ }
+
+ // This is the session we're joining.
+ if(getState() == stateJoiningSession)
+ {
+ setState(stateSessionJoined);
+
+ // SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now.
+ // Add the current user as a participant here.
+ participantState *participant = session->addParticipant(sipURIFromName(mAccountName));
+ if(participant)
+ {
+ participant->mIsSelf = true;
+ lookupName(participant->mAvatarID);
+
+ LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName
+ << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+ }
+
+ if(!session->mIsChannel)
+ {
+ // this is a p2p session. Make sure the other end is added as a participant.
+ participantState *participant = session->addParticipant(session->mSIPURI);
+ if(participant)
+ {
+ if(participant->mAvatarIDValid)
+ {
+ lookupName(participant->mAvatarID);
+ }
+ else if(!session->mName.empty())
+ {
+ participant->mDisplayName = session->mName;
+ avatarNameResolved(participant->mAvatarID, session->mName);
+ }
+
+ // TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
+ LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName
+ << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+ }
+ }
+ }
+}
+
+void LLVivoxVoiceClient::sessionRemovedEvent(
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle)
+{
+ LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
+
+ sessionState *session = findSession(sessionHandle);
+ if(session)
+ {
+ leftAudioSession(session);
+
+ // This message invalidates the session's handle. Set it to empty.
+ setSessionHandle(session);
+
+ // This also means that the session's session group is now empty.
+ // Terminate the session group so it doesn't leak.
+ sessionGroupTerminateSendMessage(session);
+
+ // Reset the media state (we now have no info)
+ session->mMediaStreamState = streamStateUnknown;
+ session->mTextStreamState = streamStateUnknown;
+
+ // Conditionally delete the session
+ reapSession(session);
+ }
+ else
+ {
+ LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::reapSession(sessionState *session)
+{
+ if(session)
+ {
+ if(!session->mHandle.empty())
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL;
+ }
+ else if(session->mCreateInProgress)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
+ }
+ else if(session->mMediaConnectInProgress)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
+ }
+ else if(session == mAudioSession)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
+ }
+ else if(session == mNextAudioSession)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
+ }
+ else
+ {
+ // TODO: Question: Should we check for queued text messages here?
+ // We don't have a reason to keep tracking this session, so just delete it.
+ LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
+ deleteSession(session);
+ session = NULL;
+ }
+ }
+ else
+ {
+// LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
+ }
+}
+
+// Returns true if the session seems to indicate we've moved to a region on a different voice server
+bool LLVivoxVoiceClient::sessionNeedsRelog(sessionState *session)
+{
+ bool result = false;
+
+ if(session != NULL)
+ {
+ // Only make this check for spatial channels (so it won't happen for group or p2p calls)
+ if(session->mIsSpatial)
+ {
+ std::string::size_type atsign;
+
+ atsign = session->mSIPURI.find("@");
+
+ if(atsign != std::string::npos)
+ {
+ std::string urihost = session->mSIPURI.substr(atsign + 1);
+ if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
+ {
+ // The hostname in this URI is different from what we expect. This probably means we need to relog.
+
+ // We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
+ // mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
+
+ result = true;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+void LLVivoxVoiceClient::leftAudioSession(
+ sessionState *session)
+{
+ if(mAudioSession == session)
+ {
+ switch(getState())
+ {
+ case stateJoiningSession:
+ case stateSessionJoined:
+ case stateRunning:
+ case stateLeavingSession:
+ case stateJoinSessionFailed:
+ case stateJoinSessionFailedWaiting:
+ // normal transition
+ LL_DEBUGS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+ setState(stateSessionTerminated);
+ break;
+
+ case stateSessionTerminated:
+ // this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
+ LL_WARNS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+ break;
+
+ default:
+ LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
+ setState(stateSessionTerminated);
+ break;
+ }
+ }
+}
+
+void LLVivoxVoiceClient::accountLoginStateChangeEvent(
+ std::string &accountHandle,
+ int statusCode,
+ std::string &statusString,
+ int state)
+{
+ /*
+ According to Mike S., status codes for this event are:
+ login_state_logged_out=0,
+ login_state_logged_in = 1,
+ login_state_logging_in = 2,
+ login_state_logging_out = 3,
+ login_state_resetting = 4,
+ login_state_error=100
+ */
+
+ LL_DEBUGS("Voice") << "state change event: " << state << LL_ENDL;
+ switch(state)
+ {
+ case 1:
+ if(getState() == stateLoggingIn)
+ {
+ setState(stateLoggedIn);
+ }
+ break;
+
+ case 3:
+ // The user is in the process of logging out.
+ setState(stateLoggingOut);
+ break;
+
+ case 0:
+ // The user has been logged out.
+ setState(stateLoggedOut);
+ break;
+
+ default:
+ //Used to be a commented out warning
+ LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
+ break;
+ }
+}
+
+void LLVivoxVoiceClient::mediaStreamUpdatedEvent(
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ int statusCode,
+ std::string &statusString,
+ int state,
+ bool incoming)
+{
+ sessionState *session = findSession(sessionHandle);
+
+ LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
+
+ if(session)
+ {
+ // We know about this session
+
+ // Save the state for later use
+ session->mMediaStreamState = state;
+
+ switch(statusCode)
+ {
+ case 0:
+ case 200:
+ // generic success
+ // Don't change the saved error code (it may have been set elsewhere)
+ break;
+ default:
+ // save the status code for later
+ session->mErrorStatusCode = statusCode;
+ break;
+ }
+
+ switch(state)
+ {
+ case streamStateIdle:
+ // Standard "left audio session"
+ session->mVoiceEnabled = false;
+ session->mMediaConnectInProgress = false;
+ leftAudioSession(session);
+ break;
+
+ case streamStateConnected:
+ session->mVoiceEnabled = true;
+ session->mMediaConnectInProgress = false;
+ joinedAudioSession(session);
+ break;
+
+ case streamStateRinging:
+ if(incoming)
+ {
+ // Send the voice chat invite to the GUI layer
+ // TODO: Question: Should we correlate with the mute list here?
+ session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
+ session->mVoiceInvitePending = true;
+ if(session->mName.empty())
+ {
+ lookupName(session->mCallerID);
+ }
+ else
+ {
+ // Act like we just finished resolving the name
+ avatarNameResolved(session->mCallerID, session->mName);
+ }
+ }
+ break;
+
+ default:
+ LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+ break;
+
+ }
+
+ }
+ else
+ {
+ LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::textStreamUpdatedEvent(
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ bool enabled,
+ int state,
+ bool incoming)
+{
+ sessionState *session = findSession(sessionHandle);
+
+ if(session)
+ {
+ // Save the state for later use
+ session->mTextStreamState = state;
+
+ // We know about this session
+ switch(state)
+ {
+ case 0: // We see this when the text stream closes
+ LL_DEBUGS("Voice") << "stream closed" << LL_ENDL;
+ break;
+
+ case 1: // We see this on an incoming call from the Connector
+ // Try to send any text messages queued for this session.
+ sendQueuedTextMessages(session);
+
+ // Send the text chat invite to the GUI layer
+ // TODO: Question: Should we correlate with the mute list here?
+ session->mTextInvitePending = true;
+ if(session->mName.empty())
+ {
+ lookupName(session->mCallerID);
+ }
+ else
+ {
+ // Act like we just finished resolving the name
+ avatarNameResolved(session->mCallerID, session->mName);
+ }
+ break;
+
+ default:
+ LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+ break;
+
+ }
+ }
+}
+
+void LLVivoxVoiceClient::participantAddedEvent(
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ std::string &uriString,
+ std::string &alias,
+ std::string &nameString,
+ std::string &displayNameString,
+ int participantType)
+{
+ sessionState *session = findSession(sessionHandle);
+ if(session)
+ {
+ participantState *participant = session->addParticipant(uriString);
+ if(participant)
+ {
+ participant->mAccountName = nameString;
+
+ LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName
+ << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+
+ if(participant->mAvatarIDValid)
+ {
+ // Initiate a lookup
+ lookupName(participant->mAvatarID);
+ }
+ else
+ {
+ // If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
+ std::string namePortion = nameFromsipURI(uriString);
+ if(namePortion.empty())
+ {
+ // Problem with the SIP URI, fall back to the display name
+ namePortion = displayNameString;
+ }
+ if(namePortion.empty())
+ {
+ // Problems with both of the above, fall back to the account name
+ namePortion = nameString;
+ }
+
+ // Set the display name (which is a hint to the active speakers window not to do its own lookup)
+ participant->mDisplayName = namePortion;
+ avatarNameResolved(participant->mAvatarID, namePortion);
+ }
+ }
+ }
+}
+
+void LLVivoxVoiceClient::participantRemovedEvent(
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ std::string &uriString,
+ std::string &alias,
+ std::string &nameString)
+{
+ sessionState *session = findSession(sessionHandle);
+ if(session)
+ {
+ participantState *participant = session->findParticipant(uriString);
+ if(participant)
+ {
+ session->removeParticipant(participant);
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+ }
+}
+
+
+void LLVivoxVoiceClient::participantUpdatedEvent(
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ std::string &uriString,
+ std::string &alias,
+ bool isModeratorMuted,
+ bool isSpeaking,
+ int volume,
+ F32 energy)
+{
+ sessionState *session = findSession(sessionHandle);
+ if(session)
+ {
+ participantState *participant = session->findParticipant(uriString);
+
+ if(participant)
+ {
+ participant->mIsSpeaking = isSpeaking;
+ participant->mIsModeratorMuted = isModeratorMuted;
+
+ // SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
+ if (isSpeaking)
+ {
+ participant->mSpeakingTimeout.reset();
+ participant->mPower = energy;
+ }
+ else
+ {
+ participant->mPower = 0.0f;
+ }
+
+ // Ignore incoming volume level if it has been explicitly set, or there
+ // is a volume or mute change pending.
+ if ( !participant->mVolumeSet && !participant->mVolumeDirty)
+ {
+ participant->mVolume = (F32)volume * VOLUME_SCALE_VIVOX;
+ }
+
+ // *HACK: mantipov: added while working on EXT-3544
+ /*
+ Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE
+ LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.
+
+ participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted
+ Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.
+ Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.
+
+ But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()
+ voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager
+ and event is not fired.
+
+ So, we have to call LLSpeakerMgr::update() here. In any case it is better than call it
+ in LLCallFloater::draw()
+ */
+ LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
+
+ // ignore session ID of local chat
+ if (voice_cnl && voice_cnl->getSessionID().notNull())
+ {
+ LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
+ if (speaker_manager)
+ {
+ speaker_manager->update(true);
+ }
+ }
+
+ }
+ else
+ {
+ LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::buddyPresenceEvent(
+ std::string &uriString,
+ std::string &alias,
+ std::string &statusString,
+ std::string &applicationString)
+{
+ buddyListEntry *buddy = findBuddy(uriString);
+
+ if(buddy)
+ {
+ LL_DEBUGS("Voice") << "Presence event for " << buddy->mDisplayName << " status \"" << statusString << "\", application \"" << applicationString << "\""<< LL_ENDL;
+ LL_DEBUGS("Voice") << "before: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+
+ if(applicationString.empty())
+ {
+ // This presence event is from a client that doesn't set up the Application string. Do things the old-skool way.
+ // NOTE: this will be needed to support people who aren't on the 3010-class SDK yet.
+
+ if ( stricmp("Unknown", statusString.c_str())== 0)
+ {
+ // User went offline with a non-SLim-enabled viewer.
+ buddy->mOnlineSL = false;
+ }
+ else if ( stricmp("Online", statusString.c_str())== 0)
+ {
+ // User came online with a non-SLim-enabled viewer.
+ buddy->mOnlineSL = true;
+ }
+ else
+ {
+ // If the user is online through SLim, their status will be "Online-slc", "Away", or something else.
+ // NOTE: we should never see this unless someone is running an OLD version of SLim -- the versions that should be in use now all set the application string.
+ buddy->mOnlineSLim = true;
+ }
+ }
+ else if(applicationString.find("SecondLifeViewer") != std::string::npos)
+ {
+ // This presence event is from a viewer that sets the application string
+ if ( stricmp("Unknown", statusString.c_str())== 0)
+ {
+ // Viewer says they're offline
+ buddy->mOnlineSL = false;
+ }
+ else
+ {
+ // Viewer says they're online
+ buddy->mOnlineSL = true;
+ }
+ }
+ else
+ {
+ // This presence event is from something which is NOT the SL viewer (assume it's SLim).
+ if ( stricmp("Unknown", statusString.c_str())== 0)
+ {
+ // SLim says they're offline
+ buddy->mOnlineSLim = false;
+ }
+ else
+ {
+ // SLim says they're online
+ buddy->mOnlineSLim = true;
+ }
+ }
+
+ LL_DEBUGS("Voice") << "after: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+
+ // HACK -- increment the internal change serial number in the LLRelationship (without changing the actual status), so the UI notices the change.
+ LLAvatarTracker::instance().setBuddyOnline(buddy->mUUID,LLAvatarTracker::instance().isBuddyOnline(buddy->mUUID));
+
+ notifyFriendObservers();
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Presence for unknown buddy " << uriString << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::messageEvent(
+ std::string &sessionHandle,
+ std::string &uriString,
+ std::string &alias,
+ std::string &messageHeader,
+ std::string &messageBody,
+ std::string &applicationString)
+{
+ LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
+// LL_DEBUGS("Voice") << " header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
+
+ if(messageHeader.find("text/html") != std::string::npos)
+ {
+ std::string message;
+
+ {
+ const std::string startMarker = "<body";
+ const std::string startMarker2 = ">";
+ const std::string endMarker = "</body>";
+ const std::string startSpan = "<span";
+ const std::string endSpan = "</span>";
+ std::string::size_type start;
+ std::string::size_type end;
+
+ // Default to displaying the raw string, so the message gets through.
+ message = messageBody;
+
+ // Find the actual message text within the XML fragment
+ start = messageBody.find(startMarker);
+ start = messageBody.find(startMarker2, start);
+ end = messageBody.find(endMarker);
+
+ if(start != std::string::npos)
+ {
+ start += startMarker2.size();
+
+ if(end != std::string::npos)
+ end -= start;
+
+ message.assign(messageBody, start, end);
+ }
+ else
+ {
+ // Didn't find a <body>, try looking for a <span> instead.
+ start = messageBody.find(startSpan);
+ start = messageBody.find(startMarker2, start);
+ end = messageBody.find(endSpan);
+
+ if(start != std::string::npos)
+ {
+ start += startMarker2.size();
+
+ if(end != std::string::npos)
+ end -= start;
+
+ message.assign(messageBody, start, end);
+ }
+ }
+ }
+
+// LL_DEBUGS("Voice") << " raw message = \n" << message << LL_ENDL;
+
+ // strip formatting tags
+ {
+ std::string::size_type start;
+ std::string::size_type end;
+
+ while((start = message.find('<')) != std::string::npos)
+ {
+ if((end = message.find('>', start + 1)) != std::string::npos)
+ {
+ // Strip out the tag
+ message.erase(start, (end + 1) - start);
+ }
+ else
+ {
+ // Avoid an infinite loop
+ break;
+ }
+ }
+ }
+
+ // Decode ampersand-escaped chars
+ {
+ std::string::size_type mark = 0;
+
+ // The text may contain text encoded with &lt;, &gt;, and &amp;
+ mark = 0;
+ while((mark = message.find("&lt;", mark)) != std::string::npos)
+ {
+ message.replace(mark, 4, "<");
+ mark += 1;
+ }
+
+ mark = 0;
+ while((mark = message.find("&gt;", mark)) != std::string::npos)
+ {
+ message.replace(mark, 4, ">");
+ mark += 1;
+ }
+
+ mark = 0;
+ while((mark = message.find("&amp;", mark)) != std::string::npos)
+ {
+ message.replace(mark, 5, "&");
+ mark += 1;
+ }
+ }
+
+ // strip leading/trailing whitespace (since we always seem to get a couple newlines)
+ LLStringUtil::trim(message);
+
+// LL_DEBUGS("Voice") << " stripped message = \n" << message << LL_ENDL;
+
+ sessionState *session = findSession(sessionHandle);
+ if(session)
+ {
+ bool is_busy = gAgent.getBusy();
+ bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
+ bool is_linden = LLMuteList::getInstance()->isLinden(session->mName);
+ bool quiet_chat = false;
+ LLChat chat;
+
+ chat.mMuted = is_muted && !is_linden;
+
+ if(!chat.mMuted)
+ {
+ chat.mFromID = session->mCallerID;
+ chat.mFromName = session->mName;
+ chat.mSourceType = CHAT_SOURCE_AGENT;
+
+ if(is_busy && !is_linden)
+ {
+ quiet_chat = true;
+ // TODO: Question: Return busy mode response here? Or maybe when session is started instead?
+ }
+
+ LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
+ gIMMgr->addMessage(session->mIMSessionID,
+ session->mCallerID,
+ session->mName.c_str(),
+ message.c_str(),
+ LLStringUtil::null, // default arg
+ IM_NOTHING_SPECIAL, // default arg
+ 0, // default arg
+ LLUUID::null, // default arg
+ LLVector3::zero, // default arg
+ true); // prepend name and make it a link to the user's profile
+
+ }
+ }
+ }
+}
+
+void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
+{
+ sessionState *session = findSession(sessionHandle);
+
+ if(session)
+ {
+ participantState *participant = session->findParticipant(uriString);
+ if(participant)
+ {
+ if (!stricmp(notificationType.c_str(), "Typing"))
+ {
+ // Other end started typing
+ // TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
+ // It requires an LLIMInfo for the message, which we don't have here.
+ }
+ else if (!stricmp(notificationType.c_str(), "NotTyping"))
+ {
+ // Other end stopped typing
+ // TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
+ // It requires an LLIMInfo for the message, which we don't have here.
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType)
+{
+ buddyListEntry *buddy = findBuddy(buddyURI);
+
+ if(!buddy)
+ {
+ // Couldn't find buddy by URI, try converting the alias...
+ if(!alias.empty())
+ {
+ LLUUID id;
+ if(IDFromName(alias, id))
+ {
+ buddy = findBuddy(id);
+ }
+ }
+ }
+
+ if(buddy)
+ {
+ std::ostringstream stream;
+
+ if(buddy->mCanSeeMeOnline)
+ {
+ // Sending the response will create an auto-accept rule
+ buddy->mHasAutoAcceptListEntry = true;
+ }
+ else
+ {
+ // Sending the response will create a block rule
+ buddy->mHasBlockListEntry = true;
+ }
+
+ if(buddy->mInSLFriends)
+ {
+ buddy->mInVivoxBuddies = true;
+ }
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.SendSubscriptionReply.1\">"
+ << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+ << "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+ << "<RuleType>" << (buddy->mCanSeeMeOnline?"Allow":"Hide") << "</RuleType>"
+ << "<AutoAccept>"<< (buddy->mInSLFriends?"1":"0")<< "</AutoAccept>"
+ << "<SubscriptionHandle>" << subscriptionHandle << "</SubscriptionHandle>"
+ << "</Request>"
+ << "\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy)
+{
+ LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
+ mTuningEnergy = energy;
+}
+
+void LLVivoxVoiceClient::buddyListChanged()
+{
+ // This is called after we receive a BuddyAndGroupListChangedEvent.
+ mBuddyListMapPopulated = true;
+ mFriendsListDirty = true;
+}
+
+void LLVivoxVoiceClient::muteListChanged()
+{
+ // The user's mute list has been updated. Go through the current participant list and sync it with the mute list.
+ if(mAudioSession)
+ {
+ participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+
+ for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+ {
+ participantState *p = iter->second;
+
+ // Check to see if this participant is on the mute list already
+ if(p->updateMuteState())
+ mAudioSession->mVolumeDirty = true;
+ }
+ }
+}
+
+void LLVivoxVoiceClient::updateFriends(U32 mask)
+{
+ if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::POWERS))
+ {
+ // Just resend the whole friend list to the daemon
+ mFriendsListDirty = true;
+ }
+}
+
+/////////////////////////////
+// Managing list of participants
+LLVivoxVoiceClient::participantState::participantState(const std::string &uri) :
+ mURI(uri),
+ mPTT(false),
+ mIsSpeaking(false),
+ mIsModeratorMuted(false),
+ mLastSpokeTimestamp(0.f),
+ mPower(0.f),
+ mVolume(LLVoiceClient::VOLUME_DEFAULT),
+ mOnMuteList(false),
+ mVolumeDirty(false),
+ mAvatarIDValid(false),
+ mIsSelf(false)
+{
+}
+
+LLVivoxVoiceClient::participantState *LLVivoxVoiceClient::sessionState::addParticipant(const std::string &uri)
+{
+ participantState *result = NULL;
+ bool useAlternateURI = false;
+
+ // Note: this is mostly the body of LLVivoxVoiceClient::sessionState::findParticipant(), but since we need to know if it
+ // matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
+ {
+ participantMap::iterator iter = mParticipantsByURI.find(uri);
+
+ if(iter == mParticipantsByURI.end())
+ {
+ if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+ {
+ // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+ // Use mSIPURI instead, since it will be properly encoded.
+ iter = mParticipantsByURI.find(mSIPURI);
+ useAlternateURI = true;
+ }
+ }
+
+ if(iter != mParticipantsByURI.end())
+ {
+ result = iter->second;
+ }
+ }
+
+ if(!result)
+ {
+ // participant isn't already in one list or the other.
+ result = new participantState(useAlternateURI?mSIPURI:uri);
+ mParticipantsByURI.insert(participantMap::value_type(result->mURI, result));
+ mParticipantsChanged = true;
+
+ // Try to do a reverse transform on the URI to get the GUID back.
+ {
+ LLUUID id;
+ if(LLVivoxVoiceClient::getInstance()->IDFromName(result->mURI, id))
+ {
+ result->mAvatarIDValid = true;
+ result->mAvatarID = id;
+ }
+ else
+ {
+ // Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
+ // This tells code in LLVivoxVoiceClient that the ID will not be in the name cache.
+ setUUIDFromStringHash(result->mAvatarID, uri);
+ }
+ }
+
+
+ if(result->updateMuteState())
+ {
+ mMuteDirty = true;
+ }
+
+ mParticipantsByUUID.insert(participantUUIDMap::value_type(result->mAvatarID, result));
+
+ if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
+ {
+ result->mVolumeDirty = true;
+ mVolumeDirty = true;
+ }
+
+ LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
+ }
+
+ return result;
+}
+
+bool LLVivoxVoiceClient::participantState::updateMuteState()
+{
+ bool result = false;
+
+
+
+ bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
+ if(mOnMuteList != isMuted)
+ {
+ mOnMuteList = isMuted;
+ mVolumeDirty = true;
+ result = true;
+ }
+ return result;
+}
+
+bool LLVivoxVoiceClient::participantState::isAvatar()
+{
+ return mAvatarIDValid;
+}
+
+void LLVivoxVoiceClient::sessionState::removeParticipant(LLVivoxVoiceClient::participantState *participant)
+{
+ if(participant)
+ {
+ participantMap::iterator iter = mParticipantsByURI.find(participant->mURI);
+ participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(participant->mAvatarID);
+
+ LL_DEBUGS("Voice") << "participant \"" << participant->mURI << "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
+
+ if(iter == mParticipantsByURI.end())
+ {
+ LL_ERRS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
+ }
+ else if(iter2 == mParticipantsByUUID.end())
+ {
+ LL_ERRS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
+ }
+ else if(iter->second != iter2->second)
+ {
+ LL_ERRS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
+ }
+ else
+ {
+ mParticipantsByURI.erase(iter);
+ mParticipantsByUUID.erase(iter2);
+
+ delete participant;
+ mParticipantsChanged = true;
+ }
+ }
+}
+
+void LLVivoxVoiceClient::sessionState::removeAllParticipants()
+{
+ LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+ while(!mParticipantsByURI.empty())
+ {
+ removeParticipant(mParticipantsByURI.begin()->second);
+ }
+
+ if(!mParticipantsByUUID.empty())
+ {
+ LL_ERRS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::getParticipantList(std::set<LLUUID> &participants)
+{
+ if(mAudioSession)
+ {
+ for(participantUUIDMap::iterator iter = mAudioSession->mParticipantsByUUID.begin();
+ iter != mAudioSession->mParticipantsByUUID.end();
+ iter++)
+ {
+ participants.insert(iter->first);
+ }
+ }
+}
+
+bool LLVivoxVoiceClient::isParticipant(const LLUUID &speaker_id)
+{
+ if(mAudioSession)
+ {
+ return (mAudioSession->mParticipantsByUUID.find(speaker_id) != mAudioSession->mParticipantsByUUID.end());
+ }
+ return false;
+}
+
+
+LLVivoxVoiceClient::participantState *LLVivoxVoiceClient::sessionState::findParticipant(const std::string &uri)
+{
+ participantState *result = NULL;
+
+ participantMap::iterator iter = mParticipantsByURI.find(uri);
+
+ if(iter == mParticipantsByURI.end())
+ {
+ if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+ {
+ // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+ // Look up the other URI
+ iter = mParticipantsByURI.find(mSIPURI);
+ }
+ }
+
+ if(iter != mParticipantsByURI.end())
+ {
+ result = iter->second;
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::participantState* LLVivoxVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
+{
+ participantState * result = NULL;
+ participantUUIDMap::iterator iter = mParticipantsByUUID.find(id);
+
+ if(iter != mParticipantsByUUID.end())
+ {
+ result = iter->second;
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::participantState* LLVivoxVoiceClient::findParticipantByID(const LLUUID& id)
+{
+ participantState * result = NULL;
+
+ if(mAudioSession)
+ {
+ result = mAudioSession->findParticipantByID(id);
+ }
+
+ return result;
+}
+
+
+void LLVivoxVoiceClient::parcelChanged()
+{
+ if(getState() >= stateNoChannel)
+ {
+ // If the user is logged in, start a channel lookup.
+ LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
+
+ std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
+ LLSD data;
+ LLHTTPClient::post(
+ url,
+ data,
+ new LLVivoxVoiceClientCapResponder);
+ }
+ else
+ {
+ // The transition to stateNoChannel needs to kick this off again.
+ LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::switchChannel(
+ std::string uri,
+ bool spatial,
+ bool no_reconnect,
+ bool is_p2p,
+ std::string hash)
+{
+ bool needsSwitch = false;
+
+ LL_DEBUGS("Voice")
+ << "called in state " << state2string(getState())
+ << " with uri \"" << uri << "\""
+ << (spatial?", spatial is true":", spatial is false")
+ << LL_ENDL;
+
+ switch(getState())
+ {
+ case stateJoinSessionFailed:
+ case stateJoinSessionFailedWaiting:
+ case stateNoChannel:
+ // Always switch to the new URI from these states.
+ needsSwitch = true;
+ break;
+
+ default:
+ if(mSessionTerminateRequested)
+ {
+ // If a terminate has been requested, we need to compare against where the URI we're already headed to.
+ if(mNextAudioSession)
+ {
+ if(mNextAudioSession->mSIPURI != uri)
+ needsSwitch = true;
+ }
+ else
+ {
+ // mNextAudioSession is null -- this probably means we're on our way back to spatial.
+ if(!uri.empty())
+ {
+ // We do want to process a switch in this case.
+ needsSwitch = true;
+ }
+ }
+ }
+ else
+ {
+ // Otherwise, compare against the URI we're in now.
+ if(mAudioSession)
+ {
+ if(mAudioSession->mSIPURI != uri)
+ {
+ needsSwitch = true;
+ }
+ }
+ else
+ {
+ if(!uri.empty())
+ {
+ // mAudioSession is null -- it's not clear what case would cause this.
+ // For now, log it as a warning and see if it ever crops up.
+ LL_WARNS("Voice") << "No current audio session." << LL_ENDL;
+ }
+ }
+ }
+ break;
+ }
+
+ if(needsSwitch)
+ {
+ if(uri.empty())
+ {
+ // Leave any channel we may be in
+ LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
+
+ sessionState *oldSession = mNextAudioSession;
+ mNextAudioSession = NULL;
+
+ // The old session may now need to be deleted.
+ reapSession(oldSession);
+
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
+
+ mNextAudioSession = addSession(uri);
+ mNextAudioSession->mHash = hash;
+ mNextAudioSession->mIsSpatial = spatial;
+ mNextAudioSession->mReconnect = !no_reconnect;
+ mNextAudioSession->mIsP2P = is_p2p;
+ }
+
+ if(getState() <= stateNoChannel)
+ {
+ // We're already set up to join a channel, just needed to fill in the session URI
+ }
+ else
+ {
+ // State machine will come around and rejoin if uri/handle is not empty.
+ sessionTerminate();
+ }
+ }
+}
+
+void LLVivoxVoiceClient::joinSession(sessionState *session)
+{
+ mNextAudioSession = session;
+
+ if(getState() <= stateNoChannel)
+ {
+ // We're already set up to join a channel, just needed to fill in the session handle
+ }
+ else
+ {
+ // State machine will come around and rejoin if uri/handle is not empty.
+ sessionTerminate();
+ }
+}
+
+void LLVivoxVoiceClient::setNonSpatialChannel(
+ const std::string &uri,
+ const std::string &credentials)
+{
+ switchChannel(uri, false, false, false, credentials);
+}
+
+void LLVivoxVoiceClient::setSpatialChannel(
+ const std::string &uri,
+ const std::string &credentials)
+{
+ mSpatialSessionURI = uri;
+ mSpatialSessionCredentials = credentials;
+ mAreaVoiceDisabled = mSpatialSessionURI.empty();
+
+ LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
+
+ if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
+ {
+ // User is in a non-spatial chat or joining a non-spatial chat. Don't switch channels.
+ LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
+ }
+ else
+ {
+ switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+ }
+}
+
+void LLVivoxVoiceClient::callUser(const LLUUID &uuid)
+{
+ std::string userURI = sipURIFromID(uuid);
+
+ switchChannel(userURI, false, true, true);
+}
+
+LLVivoxVoiceClient::sessionState* LLVivoxVoiceClient::startUserIMSession(const LLUUID &uuid)
+{
+ // Figure out if a session with the user already exists
+ sessionState *session = findSession(uuid);
+ if(!session)
+ {
+ // No session with user, need to start one.
+ std::string uri = sipURIFromID(uuid);
+ session = addSession(uri);
+
+ llassert(session);
+ if (!session) return NULL;
+
+ session->mIsSpatial = false;
+ session->mReconnect = false;
+ session->mIsP2P = true;
+ session->mCallerID = uuid;
+ }
+
+ if(session->mHandle.empty())
+ {
+ // Session isn't active -- start it up.
+ sessionCreateSendMessage(session, false, true);
+ }
+ else
+ {
+ // Session is already active -- start up text.
+ sessionTextConnectSendMessage(session);
+ }
+
+ return session;
+}
+
+BOOL LLVivoxVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
+{
+ bool result = false;
+
+ // Attempt to locate the indicated session
+ sessionState *session = startUserIMSession(participant_id);
+ if(session)
+ {
+ // found the session, attempt to send the message
+ session->mTextMsgQueue.push(message);
+
+ // Try to send queued messages (will do nothing if the session is not open yet)
+ sendQueuedTextMessages(session);
+
+ // The message is queued, so we succeed.
+ result = true;
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL;
+ }
+
+ return result;
+}
+
+void LLVivoxVoiceClient::sendQueuedTextMessages(sessionState *session)
+{
+ if(session->mTextStreamState == 1)
+ {
+ if(!session->mTextMsgQueue.empty())
+ {
+ std::ostringstream stream;
+
+ while(!session->mTextMsgQueue.empty())
+ {
+ std::string message = session->mTextMsgQueue.front();
+ session->mTextMsgQueue.pop();
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SendMessage.1\">"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "<MessageHeader>text/HTML</MessageHeader>"
+ << "<MessageBody>" << message << "</MessageBody>"
+ << "</Request>"
+ << "\n\n\n";
+ }
+ writeString(stream.str());
+ }
+ }
+ else
+ {
+ // Session isn't connected yet, defer until later.
+ }
+}
+
+void LLVivoxVoiceClient::endUserIMSession(const LLUUID &uuid)
+{
+ // Figure out if a session with the user exists
+ sessionState *session = findSession(uuid);
+ if(session)
+ {
+ // found the session
+ if(!session->mHandle.empty())
+ {
+ sessionTextDisconnectSendMessage(session);
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
+ }
+}
+bool LLVivoxVoiceClient::isValidChannel(std::string &sessionHandle)
+{
+ return(findSession(sessionHandle) != NULL);
+
+}
+bool LLVivoxVoiceClient::answerInvite(std::string &sessionHandle)
+{
+ // this is only ever used to answer incoming p2p call invites.
+
+ sessionState *session = findSession(sessionHandle);
+ if(session)
+ {
+ session->mIsSpatial = false;
+ session->mReconnect = false;
+ session->mIsP2P = true;
+
+ joinSession(session);
+ return true;
+ }
+
+ return false;
+}
+
+BOOL LLVivoxVoiceClient::isOnlineSIP(const LLUUID &id)
+{
+ bool result = false;
+ buddyListEntry *buddy = findBuddy(id);
+ if(buddy)
+ {
+ result = buddy->mOnlineSLim;
+ LL_DEBUGS("Voice") << "Buddy " << buddy->mDisplayName << " is SIP " << (result?"online":"offline") << LL_ENDL;
+ }
+
+ if(!result)
+ {
+ // This user isn't on the buddy list or doesn't show online status through the buddy list, but could be a participant in an existing session if they initiated a text IM.
+ sessionState *session = findSession(id);
+ if(session && !session->mHandle.empty())
+ {
+ if((session->mTextStreamState != streamStateUnknown) || (session->mMediaStreamState > streamStateIdle))
+ {
+ LL_DEBUGS("Voice") << "Open session with " << id << " found, returning SIP online state" << LL_ENDL;
+ // we have a p2p text session open with this user, so by definition they're online.
+ result = true;
+ }
+ }
+ }
+
+ return result;
+}
+
+bool LLVivoxVoiceClient::isVoiceWorking()
+{
+ //Added stateSessionTerminated state to avoid problems with call in parcels with disabled voice (EXT-4758)
+ // Condition with joining spatial num was added to take into account possible problems with connection to voice
+ // server(EXT-4313). See bug descriptions and comments for MAX_NORMAL_JOINING_SPATIAL_NUM for more info.
+ return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && (stateLoggedIn <= mState) && (mState <= stateSessionTerminated);
+}
+
+// Returns true if the indicated participant in the current audio session is really an SL avatar.
+// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
+BOOL LLVivoxVoiceClient::isParticipantAvatar(const LLUUID &id)
+{
+ BOOL result = TRUE;
+ sessionState *session = findSession(id);
+
+ if(session != NULL)
+ {
+ // this is a p2p session with the indicated caller, or the session with the specified UUID.
+ if(session->mSynthesizedCallerID)
+ result = FALSE;
+ }
+ else
+ {
+ // Didn't find a matching session -- check the current audio session for a matching participant
+ if(mAudioSession != NULL)
+ {
+ participantState *participant = findParticipantByID(id);
+ if(participant != NULL)
+ {
+ result = participant->isAvatar();
+ }
+ }
+ }
+
+ return result;
+}
+
+// Returns true if calling back the session URI after the session has closed is possible.
+// Currently this will be false only for PSTN P2P calls.
+BOOL LLVivoxVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
+{
+ BOOL result = TRUE;
+ sessionState *session = findSession(session_id);
+
+ if(session != NULL)
+ {
+ result = session->isCallBackPossible();
+ }
+
+ return result;
+}
+
+// Returns true if the session can accepte text IM's.
+// Currently this will be false only for PSTN P2P calls.
+BOOL LLVivoxVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
+{
+ bool result = TRUE;
+ sessionState *session = findSession(session_id);
+
+ if(session != NULL)
+ {
+ result = session->isTextIMPossible();
+ }
+
+ return result;
+}
+
+
+void LLVivoxVoiceClient::declineInvite(std::string &sessionHandle)
+{
+ sessionState *session = findSession(sessionHandle);
+ if(session)
+ {
+ sessionMediaDisconnectSendMessage(session);
+ }
+}
+
+void LLVivoxVoiceClient::leaveNonSpatialChannel()
+{
+ LL_DEBUGS("Voice")
+ << "called in state " << state2string(getState())
+ << LL_ENDL;
+
+ // Make sure we don't rejoin the current session.
+ sessionState *oldNextSession = mNextAudioSession;
+ mNextAudioSession = NULL;
+
+ // Most likely this will still be the current session at this point, but check it anyway.
+ reapSession(oldNextSession);
+
+ verifySessionState();
+
+ sessionTerminate();
+}
+
+std::string LLVivoxVoiceClient::getCurrentChannel()
+{
+ std::string result;
+
+ if((getState() == stateRunning) && !mSessionTerminateRequested)
+ {
+ result = getAudioSessionURI();
+ }
+
+ return result;
+}
+
+bool LLVivoxVoiceClient::inProximalChannel()
+{
+ bool result = false;
+
+ if((getState() == stateRunning) && !mSessionTerminateRequested)
+ {
+ result = inSpatialChannel();
+ }
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id)
+{
+ std::string result;
+ result = "sip:";
+ result += nameFromID(id);
+ result += "@";
+ result += mVoiceSIPURIHostName;
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
+{
+ std::string result;
+ if(avatar)
+ {
+ result = "sip:";
+ result += nameFromID(avatar->getID());
+ result += "@";
+ result += mVoiceSIPURIHostName;
+ }
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
+{
+ std::string result;
+ if(avatar)
+ {
+ result = nameFromID(avatar->getID());
+ }
+ return result;
+}
+
+std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid)
+{
+ std::string result;
+
+ if (uuid.isNull()) {
+ //VIVOX, the uuid emtpy look for the mURIString and return that instead.
+ //result.assign(uuid.mURIStringName);
+ LLStringUtil::replaceChar(result, '_', ' ');
+ return result;
+ }
+ // Prepending this apparently prevents conflicts with reserved names inside the vivox code.
+ result = "x";
+
+ // Base64 encode and replace the pieces of base64 that are less compatible
+ // with e-mail local-parts.
+ // See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
+ result += LLBase64::encode(uuid.mData, UUID_BYTES);
+ LLStringUtil::replaceChar(result, '+', '-');
+ LLStringUtil::replaceChar(result, '/', '_');
+
+ // If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
+ // echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
+
+ // The reverse transform can be done with:
+ // echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
+
+ return result;
+}
+
+bool LLVivoxVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
+{
+ bool result = false;
+
+ // SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
+ // If it is, convert to a bare name before doing the transform.
+ std::string name = nameFromsipURI(inName);
+
+ // Doesn't look like a SIP URI, assume it's an actual name.
+ if(name.empty())
+ name = inName;
+
+ // This will only work if the name is of the proper form.
+ // As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
+ // "xFnPP04IpREWNkuw1cOXlhw=="
+
+ if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
+ {
+ // The name appears to have the right form.
+
+ // Reverse the transforms done by nameFromID
+ std::string temp = name;
+ LLStringUtil::replaceChar(temp, '-', '+');
+ LLStringUtil::replaceChar(temp, '_', '/');
+
+ U8 rawuuid[UUID_BYTES + 1];
+ int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
+ if(len == UUID_BYTES)
+ {
+ // The decode succeeded. Stuff the bits into the result's UUID
+ memcpy(uuid.mData, rawuuid, UUID_BYTES);
+ result = true;
+ }
+ }
+
+ if(!result)
+ {
+ // VIVOX: not a standard account name, just copy the URI name mURIString field
+ // and hope for the best. bpj
+ uuid.setNull(); // VIVOX, set the uuid field to nulls
+ }
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
+{
+ return avatar->getFullname();
+}
+
+std::string LLVivoxVoiceClient::sipURIFromName(std::string &name)
+{
+ std::string result;
+ result = "sip:";
+ result += name;
+ result += "@";
+ result += mVoiceSIPURIHostName;
+
+// LLStringUtil::toLower(result);
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::nameFromsipURI(const std::string &uri)
+{
+ std::string result;
+
+ std::string::size_type sipOffset, atOffset;
+ sipOffset = uri.find("sip:");
+ atOffset = uri.find("@");
+ if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
+ {
+ result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
+ }
+
+ return result;
+}
+
+bool LLVivoxVoiceClient::inSpatialChannel(void)
+{
+ bool result = false;
+
+ if(mAudioSession)
+ result = mAudioSession->mIsSpatial;
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::getAudioSessionURI()
+{
+ std::string result;
+
+ if(mAudioSession)
+ result = mAudioSession->mSIPURI;
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::getAudioSessionHandle()
+{
+ std::string result;
+
+ if(mAudioSession)
+ result = mAudioSession->mHandle;
+
+ return result;
+}
+
+
+/////////////////////////////
+// Sending updates of current state
+
+void LLVivoxVoiceClient::enforceTether(void)
+{
+ LLVector3d tethered = mCameraRequestedPosition;
+
+ // constrain 'tethered' to within 50m of mAvatarPosition.
+ {
+ F32 max_dist = 50.0f;
+ LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
+ F32 camera_distance = (F32)camera_offset.magVec();
+ if(camera_distance > max_dist)
+ {
+ tethered = mAvatarPosition +
+ (max_dist / camera_distance) * camera_offset;
+ }
+ }
+
+ if(dist_vec(mCameraPosition, tethered) > 0.1)
+ {
+ mCameraPosition = tethered;
+ mSpatialCoordsDirty = true;
+ }
+}
+
+void LLVivoxVoiceClient::updatePosition(void)
+{
+
+ LLViewerRegion *region = gAgent.getRegion();
+ if(region && isAgentAvatarValid())
+ {
+ LLMatrix3 rot;
+ LLVector3d pos;
+
+ // TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
+ // They're currently always set to zero.
+
+ // Send the current camera position to the voice code
+ rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (), LLViewerCamera::getInstance()->getUpAxis());
+ pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
+
+ LLVivoxVoiceClient::getInstance()->setCameraPosition(
+ pos, // position
+ LLVector3::zero, // velocity
+ rot); // rotation matrix
+
+ // Send the current avatar position to the voice code
+ rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3();
+ pos = gAgentAvatarp->getPositionGlobal();
+
+ // TODO: Can we get the head offset from outside the LLVOAvatar?
+ // pos += LLVector3d(mHeadOffset);
+ pos += LLVector3d(0.f, 0.f, 1.f);
+
+ LLVivoxVoiceClient::getInstance()->setAvatarPosition(
+ pos, // position
+ LLVector3::zero, // velocity
+ rot); // rotation matrix
+ }
+}
+
+void LLVivoxVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+ mCameraRequestedPosition = position;
+
+ if(mCameraVelocity != velocity)
+ {
+ mCameraVelocity = velocity;
+ mSpatialCoordsDirty = true;
+ }
+
+ if(mCameraRot != rot)
+ {
+ mCameraRot = rot;
+ mSpatialCoordsDirty = true;
+ }
+}
+
+void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+ if(dist_vec(mAvatarPosition, position) > 0.1)
+ {
+ mAvatarPosition = position;
+ mSpatialCoordsDirty = true;
+ }
+
+ if(mAvatarVelocity != velocity)
+ {
+ mAvatarVelocity = velocity;
+ mSpatialCoordsDirty = true;
+ }
+
+ if(mAvatarRot != rot)
+ {
+ mAvatarRot = rot;
+ mSpatialCoordsDirty = true;
+ }
+}
+
+bool LLVivoxVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
+{
+ bool result = false;
+
+ if(region)
+ {
+ name = region->getName();
+ }
+
+ if(!name.empty())
+ result = true;
+
+ return result;
+}
+
+void LLVivoxVoiceClient::leaveChannel(void)
+{
+ if(getState() == stateRunning)
+ {
+ LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
+ mChannelName.clear();
+ sessionTerminate();
+ }
+}
+
+void LLVivoxVoiceClient::setMuteMic(bool muted)
+{
+ mMuteMic = muted;
+}
+
+void LLVivoxVoiceClient::setUserPTTState(bool ptt)
+{
+ mUserPTTState = ptt;
+}
+
+bool LLVivoxVoiceClient::getUserPTTState()
+{
+ return mUserPTTState;
+}
+
+void LLVivoxVoiceClient::inputUserControlState(bool down)
+{
+ if(mPTTIsToggle)
+ {
+ if(down) // toggle open-mic state on 'down'
+ {
+ toggleUserPTTState();
+ }
+ }
+ else // set open-mic state as an absolute
+ {
+ setUserPTTState(down);
+ }
+}
+
+
+void LLVivoxVoiceClient::toggleUserPTTState(void)
+{
+ mUserPTTState = !mUserPTTState;
+}
+
+void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
+{
+ if (enabled != mVoiceEnabled)
+ {
+ // TODO: Refactor this so we don't call into LLVoiceChannel, but simply
+ // use the status observer
+ mVoiceEnabled = enabled;
+ LLVoiceClientStatusObserver::EStatusType status;
+
+
+ if (enabled)
+ {
+ LLVoiceChannel::getCurrentVoiceChannel()->activate();
+ status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
+ }
+ else
+ {
+ // Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
+ LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
+ status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
+ }
+ }
+}
+
+bool LLVivoxVoiceClient::voiceEnabled()
+{
+ return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
+}
+
+void LLVivoxVoiceClient::setLipSyncEnabled(BOOL enabled)
+{
+ mLipSyncEnabled = enabled;
+}
+
+BOOL LLVivoxVoiceClient::lipSyncEnabled()
+{
+
+ if ( mVoiceEnabled && stateDisabled != getState() )
+ {
+ return mLipSyncEnabled;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+void LLVivoxVoiceClient::setUsePTT(bool usePTT)
+{
+ if(usePTT && !mUsePTT)
+ {
+ // When the user turns on PTT, reset the current state.
+ mUserPTTState = false;
+ }
+ mUsePTT = usePTT;
+}
+
+void LLVivoxVoiceClient::setPTTIsToggle(bool PTTIsToggle)
+{
+ if(!PTTIsToggle && mPTTIsToggle)
+ {
+ // When the user turns off toggle, reset the current state.
+ mUserPTTState = false;
+ }
+
+ mPTTIsToggle = PTTIsToggle;
+}
+
+bool LLVivoxVoiceClient::getPTTIsToggle()
+{
+ return mPTTIsToggle;
+}
+
+void LLVivoxVoiceClient::setPTTKey(std::string &key)
+{
+ if(key == "MiddleMouse")
+ {
+ mPTTIsMiddleMouse = true;
+ }
+ else
+ {
+ mPTTIsMiddleMouse = false;
+ if(!LLKeyboard::keyFromString(key, &mPTTKey))
+ {
+ // If the call failed, don't match any key.
+ key = KEY_NONE;
+ }
+ }
+}
+
+void LLVivoxVoiceClient::setEarLocation(S32 loc)
+{
+ if(mEarLocation != loc)
+ {
+ LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
+
+ mEarLocation = loc;
+ mSpatialCoordsDirty = true;
+ }
+}
+
+void LLVivoxVoiceClient::setVoiceVolume(F32 volume)
+{
+ int scaled_volume = scale_speaker_volume(volume);
+
+ if(scaled_volume != mSpeakerVolume)
+ {
+ int min_volume = scale_speaker_volume(0);
+ if((scaled_volume == min_volume) || (mSpeakerVolume == min_volume))
+ {
+ mSpeakerMuteDirty = true;
+ }
+
+ mSpeakerVolume = scaled_volume;
+ mSpeakerVolumeDirty = true;
+ }
+}
+
+void LLVivoxVoiceClient::setMicGain(F32 volume)
+{
+ int scaled_volume = scale_mic_volume(volume);
+
+ if(scaled_volume != mMicVolume)
+ {
+ mMicVolume = scaled_volume;
+ mMicVolumeDirty = true;
+ }
+}
+
+void LLVivoxVoiceClient::keyDown(KEY key, MASK mask)
+{
+ if (gKeyboard->getKeyRepeated(key))
+ {
+ // ignore auto-repeat keys
+ return;
+ }
+
+ if(!mPTTIsMiddleMouse)
+ {
+ bool down = (mPTTKey != KEY_NONE)
+ && gKeyboard->getKeyDown(mPTTKey);
+ inputUserControlState(down);
+ }
+
+
+}
+void LLVivoxVoiceClient::keyUp(KEY key, MASK mask)
+{
+ if(!mPTTIsMiddleMouse)
+ {
+ bool down = (mPTTKey != KEY_NONE)
+ && gKeyboard->getKeyDown(mPTTKey);
+ inputUserControlState(down);
+ }
+
+}
+void LLVivoxVoiceClient::middleMouseState(bool down)
+{
+ if(mPTTIsMiddleMouse)
+ {
+ if(mPTTIsMiddleMouse)
+ {
+ inputUserControlState(down);
+ }
+ }
+}
+
+/////////////////////////////
+// Accessors for data related to nearby speakers
+BOOL LLVivoxVoiceClient::getVoiceEnabled(const LLUUID& id)
+{
+ BOOL result = FALSE;
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ // I'm not sure what the semantics of this should be.
+ // For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
+ result = TRUE;
+ }
+
+ return result;
+}
+
+std::string LLVivoxVoiceClient::getDisplayName(const LLUUID& id)
+{
+ std::string result;
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ result = participant->mDisplayName;
+ }
+
+ return result;
+}
+
+
+
+BOOL LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id)
+{
+ BOOL result = FALSE;
+
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
+ {
+ participant->mIsSpeaking = FALSE;
+ }
+ result = participant->mIsSpeaking;
+ }
+
+ return result;
+}
+
+BOOL LLVivoxVoiceClient::getIsModeratorMuted(const LLUUID& id)
+{
+ BOOL result = FALSE;
+
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ result = participant->mIsModeratorMuted;
+ }
+
+ return result;
+}
+
+F32 LLVivoxVoiceClient::getCurrentPower(const LLUUID& id)
+{
+ F32 result = 0;
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ result = participant->mPower;
+ }
+
+ return result;
+}
+
+
+
+BOOL LLVivoxVoiceClient::getUsingPTT(const LLUUID& id)
+{
+ BOOL result = FALSE;
+
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ // I'm not sure what the semantics of this should be.
+ // Does "using PTT" mean they're configured with a push-to-talk button?
+ // For now, we know there's no PTT mechanism in place, so nobody is using it.
+ }
+
+ return result;
+}
+
+BOOL LLVivoxVoiceClient::getOnMuteList(const LLUUID& id)
+{
+ BOOL result = FALSE;
+
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ result = participant->mOnMuteList;
+ }
+
+ return result;
+}
+
+// External accessors.
+F32 LLVivoxVoiceClient::getUserVolume(const LLUUID& id)
+{
+ // Minimum volume will be returned for users with voice disabled
+ F32 result = LLVoiceClient::VOLUME_MIN;
+
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ result = participant->mVolume;
+
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "mVolume = " << result << " for " << id << LL_ENDL;
+ }
+
+ return result;
+}
+
+void LLVivoxVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
+{
+ if(mAudioSession)
+ {
+ participantState *participant = findParticipantByID(id);
+ if (participant && !participant->mIsSelf)
+ {
+ if (!is_approx_equal(volume, LLVoiceClient::VOLUME_DEFAULT))
+ {
+ // Store this volume setting for future sessions if it has been
+ // changed from the default
+ LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
+ }
+ else
+ {
+ // Remove stored volume setting if it is returned to the default
+ LLSpeakerVolumeStorage::getInstance()->removeSpeakerVolume(id);
+ }
+
+ participant->mVolume = llclamp(volume, LLVoiceClient::VOLUME_MIN, LLVoiceClient::VOLUME_MAX);
+ participant->mVolumeDirty = true;
+ mAudioSession->mVolumeDirty = true;
+ }
+ }
+}
+
+std::string LLVivoxVoiceClient::getGroupID(const LLUUID& id)
+{
+ std::string result;
+
+ participantState *participant = findParticipantByID(id);
+ if(participant)
+ {
+ result = participant->mGroupID;
+ }
+
+ return result;
+}
+
+BOOL LLVivoxVoiceClient::getAreaVoiceDisabled()
+{
+ return mAreaVoiceDisabled;
+}
+
+void LLVivoxVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
+{
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
+
+ if(!mMainSessionGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Start</RecordingControlType>"
+ << "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
+ << "<Filename>" << "" << "</Filename>"
+ << "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
+ << "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
+ << "</Request>\n\n\n";
+
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::recordingLoopSave(const std::string& filename)
+{
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
+
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Flush</RecordingControlType>"
+ << "<Filename>" << filename << "</Filename>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::recordingStop()
+{
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
+
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Stop</RecordingControlType>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::filePlaybackStart(const std::string& filename)
+{
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
+
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Start</RecordingControlType>"
+ << "<Filename>" << filename << "</Filename>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::filePlaybackStop()
+{
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
+
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Stop</RecordingControlType>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+ }
+}
+
+void LLVivoxVoiceClient::filePlaybackSetPaused(bool paused)
+{
+ // TODO: Implement once Vivox gives me a sample
+}
+
+void LLVivoxVoiceClient::filePlaybackSetMode(bool vox, float speed)
+{
+ // TODO: Implement once Vivox gives me a sample
+}
+
+LLVivoxVoiceClient::sessionState::sessionState() :
+ mErrorStatusCode(0),
+ mMediaStreamState(streamStateUnknown),
+ mTextStreamState(streamStateUnknown),
+ mCreateInProgress(false),
+ mMediaConnectInProgress(false),
+ mVoiceInvitePending(false),
+ mTextInvitePending(false),
+ mSynthesizedCallerID(false),
+ mIsChannel(false),
+ mIsSpatial(false),
+ mIsP2P(false),
+ mIncoming(false),
+ mVoiceEnabled(false),
+ mReconnect(false),
+ mVolumeDirty(false),
+ mParticipantsChanged(false)
+{
+}
+
+LLVivoxVoiceClient::sessionState::~sessionState()
+{
+ removeAllParticipants();
+}
+
+bool LLVivoxVoiceClient::sessionState::isCallBackPossible()
+{
+ // This may change to be explicitly specified by vivox in the future...
+ // Currently, only PSTN P2P calls cannot be returned.
+ // Conveniently, this is also the only case where we synthesize a caller UUID.
+ return !mSynthesizedCallerID;
+}
+
+bool LLVivoxVoiceClient::sessionState::isTextIMPossible()
+{
+ // This may change to be explicitly specified by vivox in the future...
+ return !mSynthesizedCallerID;
+}
+
+
+LLVivoxVoiceClient::sessionIterator LLVivoxVoiceClient::sessionsBegin(void)
+{
+ return mSessions.begin();
+}
+
+LLVivoxVoiceClient::sessionIterator LLVivoxVoiceClient::sessionsEnd(void)
+{
+ return mSessions.end();
+}
+
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSession(const std::string &handle)
+{
+ sessionState *result = NULL;
+ sessionMap::iterator iter = mSessionsByHandle.find(handle);
+ if(iter != mSessionsByHandle.end())
+ {
+ result = iter->second;
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
+{
+ sessionState *result = NULL;
+ for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+ {
+ sessionState *session = *iter;
+ if(session->mCreateInProgress && (session->mSIPURI == uri))
+ {
+ result = session;
+ break;
+ }
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSession(const LLUUID &participant_id)
+{
+ sessionState *result = NULL;
+
+ for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+ {
+ sessionState *session = *iter;
+ if((session->mCallerID == participant_id) || (session->mIMSessionID == participant_id))
+ {
+ result = session;
+ break;
+ }
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::addSession(const std::string &uri, const std::string &handle)
+{
+ sessionState *result = NULL;
+
+ if(handle.empty())
+ {
+ // No handle supplied.
+ // Check whether there's already a session with this URI
+ for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+ {
+ sessionState *s = *iter;
+ if((s->mSIPURI == uri) || (s->mAlternateSIPURI == uri))
+ {
+ // TODO: I need to think about this logic... it's possible that this case should raise an internal error.
+ result = s;
+ break;
+ }
+ }
+ }
+ else // (!handle.empty())
+ {
+ // Check for an existing session with this handle
+ sessionMap::iterator iter = mSessionsByHandle.find(handle);
+
+ if(iter != mSessionsByHandle.end())
+ {
+ result = iter->second;
+ }
+ }
+
+ if(!result)
+ {
+ // No existing session found.
+
+ LL_DEBUGS("Voice") << "adding new session: handle " << handle << " URI " << uri << LL_ENDL;
+ result = new sessionState();
+ result->mSIPURI = uri;
+ result->mHandle = handle;
+
+ mSessions.insert(result);
+
+ if(!result->mHandle.empty())
+ {
+ mSessionsByHandle.insert(sessionMap::value_type(result->mHandle, result));
+ }
+ }
+ else
+ {
+ // Found an existing session
+
+ if(uri != result->mSIPURI)
+ {
+ // TODO: Should this be an internal error?
+ LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
+ setSessionURI(result, uri);
+ }
+
+ if(handle != result->mHandle)
+ {
+ if(handle.empty())
+ {
+ // There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
+ LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
+ }
+ else
+ {
+ // TODO: Should this be an internal error?
+ LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
+ setSessionHandle(result, handle);
+ }
+ }
+
+ LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
+ }
+
+ verifySessionState();
+
+ return result;
+}
+
+void LLVivoxVoiceClient::setSessionHandle(sessionState *session, const std::string &handle)
+{
+ // Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
+
+ if(!session->mHandle.empty())
+ {
+ // Remove session from the map if it should have been there.
+ sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
+ if(iter != mSessionsByHandle.end())
+ {
+ if(iter->second != session)
+ {
+ LL_ERRS("Voice") << "Internal error: session mismatch!" << LL_ENDL;
+ }
+
+ mSessionsByHandle.erase(iter);
+ }
+ else
+ {
+ LL_ERRS("Voice") << "Internal error: session handle not found in map!" << LL_ENDL;
+ }
+ }
+
+ session->mHandle = handle;
+
+ if(!handle.empty())
+ {
+ mSessionsByHandle.insert(sessionMap::value_type(session->mHandle, session));
+ }
+
+ verifySessionState();
+}
+
+void LLVivoxVoiceClient::setSessionURI(sessionState *session, const std::string &uri)
+{
+ // There used to be a map of session URIs to sessions, which made this complex....
+ session->mSIPURI = uri;
+
+ verifySessionState();
+}
+
+void LLVivoxVoiceClient::deleteSession(sessionState *session)
+{
+ // Remove the session from the handle map
+ if(!session->mHandle.empty())
+ {
+ sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
+ if(iter != mSessionsByHandle.end())
+ {
+ if(iter->second != session)
+ {
+ LL_ERRS("Voice") << "Internal error: session mismatch" << LL_ENDL;
+ }
+ mSessionsByHandle.erase(iter);
+ }
+ }
+
+ // Remove the session from the URI map
+ mSessions.erase(session);
+
+ // At this point, the session should be unhooked from all lists and all state should be consistent.
+ verifySessionState();
+
+ // If this is the current audio session, clean up the pointer which will soon be dangling.
+ if(mAudioSession == session)
+ {
+ mAudioSession = NULL;
+ mAudioSessionChanged = true;
+ }
+
+ // ditto for the next audio session
+ if(mNextAudioSession == session)
+ {
+ mNextAudioSession = NULL;
+ }
+
+ // delete the session
+ delete session;
+}
+
+void LLVivoxVoiceClient::deleteAllSessions()
+{
+ LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+ while(!mSessions.empty())
+ {
+ deleteSession(*(sessionsBegin()));
+ }
+
+ if(!mSessionsByHandle.empty())
+ {
+ LL_ERRS("Voice") << "Internal error: empty session map, non-empty handle map" << LL_ENDL;
+ }
+}
+
+void LLVivoxVoiceClient::verifySessionState(void)
+{
+ // This is mostly intended for debugging problems with session state management.
+ LL_DEBUGS("Voice") << "Total session count: " << mSessions.size() << " , session handle map size: " << mSessionsByHandle.size() << LL_ENDL;
+
+ for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+ {
+ sessionState *session = *iter;
+
+ LL_DEBUGS("Voice") << "session " << session << ": handle " << session->mHandle << ", URI " << session->mSIPURI << LL_ENDL;
+
+ if(!session->mHandle.empty())
+ {
+ // every session with a non-empty handle needs to be in the handle map
+ sessionMap::iterator i2 = mSessionsByHandle.find(session->mHandle);
+ if(i2 == mSessionsByHandle.end())
+ {
+ LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+ }
+ else
+ {
+ if(i2->second != session)
+ {
+ LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " in session map points to another session)" << LL_ENDL;
+ }
+ }
+ }
+ }
+
+ // check that every entry in the handle map points to a valid session in the session set
+ for(sessionMap::iterator iter = mSessionsByHandle.begin(); iter != mSessionsByHandle.end(); iter++)
+ {
+ sessionState *session = iter->second;
+ sessionIterator i2 = mSessions.find(session);
+ if(i2 == mSessions.end())
+ {
+ LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+ }
+ else
+ {
+ if(session->mHandle != (*i2)->mHandle)
+ {
+ LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " points to session with different handle " << (*i2)->mHandle << ")" << LL_ENDL;
+ }
+ }
+ }
+}
+
+LLVivoxVoiceClient::buddyListEntry::buddyListEntry(const std::string &uri) :
+ mURI(uri)
+{
+ mOnlineSL = false;
+ mOnlineSLim = false;
+ mCanSeeMeOnline = true;
+ mHasBlockListEntry = false;
+ mHasAutoAcceptListEntry = false;
+ mNameResolved = false;
+ mInVivoxBuddies = false;
+ mInSLFriends = false;
+ mNeedsNameUpdate = false;
+}
+
+void LLVivoxVoiceClient::processBuddyListEntry(const std::string &uri, const std::string &displayName)
+{
+ buddyListEntry *buddy = addBuddy(uri, displayName);
+ buddy->mInVivoxBuddies = true;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::addBuddy(const std::string &uri)
+{
+ std::string empty;
+ buddyListEntry *buddy = addBuddy(uri, empty);
+ if(buddy->mDisplayName.empty())
+ {
+ buddy->mNameResolved = false;
+ }
+ return buddy;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::addBuddy(const std::string &uri, const std::string &displayName)
+{
+ buddyListEntry *result = NULL;
+ buddyListMap::iterator iter = mBuddyListMap.find(uri);
+
+ if(iter != mBuddyListMap.end())
+ {
+ // Found a matching buddy already in the map.
+ LL_DEBUGS("Voice") << "adding existing buddy " << uri << LL_ENDL;
+ result = iter->second;
+ }
+
+ if(!result)
+ {
+ // participant isn't already in one list or the other.
+ LL_DEBUGS("Voice") << "adding new buddy " << uri << LL_ENDL;
+ result = new buddyListEntry(uri);
+ result->mDisplayName = displayName;
+
+ if(IDFromName(uri, result->mUUID))
+ {
+ // Extracted UUID from name successfully.
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Couldn't find ID for buddy " << uri << " (\"" << displayName << "\")" << LL_ENDL;
+ }
+
+ mBuddyListMap.insert(buddyListMap::value_type(result->mURI, result));
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddy(const std::string &uri)
+{
+ buddyListEntry *result = NULL;
+ buddyListMap::iterator iter = mBuddyListMap.find(uri);
+ if(iter != mBuddyListMap.end())
+ {
+ result = iter->second;
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddy(const LLUUID &id)
+{
+ buddyListEntry *result = NULL;
+ buddyListMap::iterator iter;
+
+ for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
+ {
+ if(iter->second->mUUID == id)
+ {
+ result = iter->second;
+ break;
+ }
+ }
+
+ return result;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddyByDisplayName(const std::string &name)
+{
+ buddyListEntry *result = NULL;
+ buddyListMap::iterator iter;
+
+ for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
+ {
+ if(iter->second->mDisplayName == name)
+ {
+ result = iter->second;
+ break;
+ }
+ }
+
+ return result;
+}
+
+void LLVivoxVoiceClient::deleteBuddy(const std::string &uri)
+{
+ buddyListMap::iterator iter = mBuddyListMap.find(uri);
+ if(iter != mBuddyListMap.end())
+ {
+ LL_DEBUGS("Voice") << "deleting buddy " << uri << LL_ENDL;
+ buddyListEntry *buddy = iter->second;
+ mBuddyListMap.erase(iter);
+ delete buddy;
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "attempt to delete nonexistent buddy " << uri << LL_ENDL;
+ }
+
+}
+
+void LLVivoxVoiceClient::deleteAllBuddies(void)
+{
+ while(!mBuddyListMap.empty())
+ {
+ deleteBuddy(mBuddyListMap.begin()->first);
+ }
+
+ // Don't want to correlate with friends list when we've emptied the buddy list.
+ mBuddyListMapPopulated = false;
+
+ // Don't want to correlate with friends list when we've reset the block rules.
+ mBlockRulesListReceived = false;
+ mAutoAcceptRulesListReceived = false;
+}
+
+void LLVivoxVoiceClient::deleteAllBlockRules(void)
+{
+ // Clear the block list entry flags from all local buddy list entries
+ buddyListMap::iterator buddy_it;
+ for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+ {
+ buddy_it->second->mHasBlockListEntry = false;
+ }
+}
+
+void LLVivoxVoiceClient::deleteAllAutoAcceptRules(void)
+{
+ // Clear the auto-accept list entry flags from all local buddy list entries
+ buddyListMap::iterator buddy_it;
+ for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+ {
+ buddy_it->second->mHasAutoAcceptListEntry = false;
+ }
+}
+
+void LLVivoxVoiceClient::addBlockRule(const std::string &blockMask, const std::string &presenceOnly)
+{
+ buddyListEntry *buddy = NULL;
+
+ // blockMask is the SIP URI of a friends list entry
+ buddyListMap::iterator iter = mBuddyListMap.find(blockMask);
+ if(iter != mBuddyListMap.end())
+ {
+ LL_DEBUGS("Voice") << "block list entry for " << blockMask << LL_ENDL;
+ buddy = iter->second;
+ }
+
+ if(buddy == NULL)
+ {
+ LL_DEBUGS("Voice") << "block list entry for unknown buddy " << blockMask << LL_ENDL;
+ buddy = addBuddy(blockMask);
+ }
+
+ if(buddy != NULL)
+ {
+ buddy->mHasBlockListEntry = true;
+ }
+}
+
+void LLVivoxVoiceClient::addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy)
+{
+ buddyListEntry *buddy = NULL;
+
+ // blockMask is the SIP URI of a friends list entry
+ buddyListMap::iterator iter = mBuddyListMap.find(autoAcceptMask);
+ if(iter != mBuddyListMap.end())
+ {
+ LL_DEBUGS("Voice") << "auto-accept list entry for " << autoAcceptMask << LL_ENDL;
+ buddy = iter->second;
+ }
+
+ if(buddy == NULL)
+ {
+ LL_DEBUGS("Voice") << "auto-accept list entry for unknown buddy " << autoAcceptMask << LL_ENDL;
+ buddy = addBuddy(autoAcceptMask);
+ }
+
+ if(buddy != NULL)
+ {
+ buddy->mHasAutoAcceptListEntry = true;
+ }
+}
+
+void LLVivoxVoiceClient::accountListBlockRulesResponse(int statusCode, const std::string &statusString)
+{
+ // Block list entries were updated via addBlockRule() during parsing. Just flag that we're done.
+ mBlockRulesListReceived = true;
+}
+
+void LLVivoxVoiceClient::accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString)
+{
+ // Block list entries were updated via addBlockRule() during parsing. Just flag that we're done.
+ mAutoAcceptRulesListReceived = true;
+}
+
+void LLVivoxVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
+{
+ mParticipantObservers.insert(observer);
+}
+
+void LLVivoxVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
+{
+ mParticipantObservers.erase(observer);
+}
+
+void LLVivoxVoiceClient::notifyParticipantObservers()
+{
+ for (observer_set_t::iterator it = mParticipantObservers.begin();
+ it != mParticipantObservers.end();
+ )
+ {
+ LLVoiceClientParticipantObserver* observer = *it;
+ observer->onChange();
+ // In case onChange() deleted an entry.
+ it = mParticipantObservers.upper_bound(observer);
+ }
+}
+
+void LLVivoxVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
+{
+ mStatusObservers.insert(observer);
+}
+
+void LLVivoxVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
+{
+ mStatusObservers.erase(observer);
+}
+
+void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
+{
+ if(mAudioSession)
+ {
+ if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
+ {
+ switch(mAudioSession->mErrorStatusCode)
+ {
+ case 20713: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; break;
+ case 20714: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; break;
+ case 20715:
+ //invalid channel, we may be using a set of poorly cached
+ //info
+ status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+ break;
+ case 1009:
+ //invalid username and password
+ status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+ break;
+ }
+
+ // Reset the error code to make sure it won't be reused later by accident.
+ mAudioSession->mErrorStatusCode = 0;
+ }
+ else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
+ {
+ switch(mAudioSession->mErrorStatusCode)
+ {
+ case 404: // NOT_FOUND
+ case 480: // TEMPORARILY_UNAVAILABLE
+ case 408: // REQUEST_TIMEOUT
+ // call failed because other user was not available
+ // treat this as an error case
+ status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+
+ // Reset the error code to make sure it won't be reused later by accident.
+ mAudioSession->mErrorStatusCode = 0;
+ break;
+ }
+ }
+ }
+
+ LL_DEBUGS("Voice")
+ << " " << LLVoiceClientStatusObserver::status2string(status)
+ << ", session URI " << getAudioSessionURI()
+ << (inSpatialChannel()?", proximal is true":", proximal is false")
+ << LL_ENDL;
+
+ for (status_observer_set_t::iterator it = mStatusObservers.begin();
+ it != mStatusObservers.end();
+ )
+ {
+ LLVoiceClientStatusObserver* observer = *it;
+ observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
+ // In case onError() deleted an entry.
+ it = mStatusObservers.upper_bound(observer);
+ }
+
+}
+
+void LLVivoxVoiceClient::addObserver(LLFriendObserver* observer)
+{
+ mFriendObservers.insert(observer);
+}
+
+void LLVivoxVoiceClient::removeObserver(LLFriendObserver* observer)
+{
+ mFriendObservers.erase(observer);
+}
+
+void LLVivoxVoiceClient::notifyFriendObservers()
+{
+ for (friend_observer_set_t::iterator it = mFriendObservers.begin();
+ it != mFriendObservers.end();
+ )
+ {
+ LLFriendObserver* observer = *it;
+ it++;
+ // The only friend-related thing we notify on is online/offline transitions.
+ observer->changed(LLFriendObserver::ONLINE);
+ }
+}
+
+void LLVivoxVoiceClient::lookupName(const LLUUID &id)
+{
+ BOOL is_group = FALSE;
+ gCacheName->get(id, is_group, &LLVivoxVoiceClient::onAvatarNameLookup);
+}
+
+//static
+void LLVivoxVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
+{
+ std::string name = llformat("%s %s", first.c_str(), last.c_str());
+ LLVivoxVoiceClient::getInstance()->avatarNameResolved(id, name);
+
+}
+
+void LLVivoxVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
+{
+ // If the avatar whose name just resolved is on our friends list, resync the friends list.
+ if(LLAvatarTracker::instance().getBuddyInfo(id) != NULL)
+ {
+ mFriendsListDirty = true;
+ }
+ // Iterate over all sessions.
+ for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+ {
+ sessionState *session = *iter;
+ // Check for this user as a participant in this session
+ participantState *participant = session->findParticipantByID(id);
+ if(participant)
+ {
+ // Found -- fill in the name
+ participant->mAccountName = name;
+ // and post a "participants updated" message to listeners later.
+ session->mParticipantsChanged = true;
+ }
+
+ // Check whether this is a p2p session whose caller name just resolved
+ if(session->mCallerID == id)
+ {
+ // this session's "caller ID" just resolved. Fill in the name.
+ session->mName = name;
+ if(session->mTextInvitePending)
+ {
+ session->mTextInvitePending = false;
+
+ // We don't need to call gIMMgr->addP2PSession() here. The first incoming message will create the panel.
+ }
+ if(session->mVoiceInvitePending)
+ {
+ session->mVoiceInvitePending = false;
+
+ gIMMgr->inviteToSession(
+ session->mIMSessionID,
+ session->mName,
+ session->mCallerID,
+ session->mName,
+ IM_SESSION_P2P_INVITE,
+ LLIMMgr::INVITATION_TYPE_VOICE,
+ session->mHandle,
+ session->mSIPURI);
+ }
+
+ }
+ }
+}
+
+
+LLVivoxProtocolParser::LLVivoxProtocolParser()
+{
+ parser = NULL;
+ parser = XML_ParserCreate(NULL);
+
+ reset();
+}
+
+void LLVivoxProtocolParser::reset()
+{
+ responseDepth = 0;
+ ignoringTags = false;
+ accumulateText = false;
+ energy = 0.f;
+ hasText = false;
+ hasAudio = false;
+ hasVideo = false;
+ terminated = false;
+ ignoreDepth = 0;
+ isChannel = false;
+ incoming = false;
+ enabled = false;
+ isEvent = false;
+ isLocallyMuted = false;
+ isModeratorMuted = false;
+ isSpeaking = false;
+ participantType = 0;
+ squelchDebugOutput = false;
+ returnCode = -1;
+ state = 0;
+ statusCode = 0;
+ volume = 0;
+ textBuffer.clear();
+ alias.clear();
+ numberOfAliases = 0;
+ applicationString.clear();
+}
+
+//virtual
+LLVivoxProtocolParser::~LLVivoxProtocolParser()
+{
+ if (parser)
+ XML_ParserFree(parser);
+}
+
+// virtual
+LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
+ const LLChannelDescriptors& channels,
+ buffer_ptr_t& buffer,
+ bool& eos,
+ LLSD& context,
+ LLPumpIO* pump)
+{
+ LLBufferStream istr(channels, buffer.get());
+ std::ostringstream ostr;
+ while (istr.good())
+ {
+ char buf[1024];
+ istr.read(buf, sizeof(buf));
+ mInput.append(buf, istr.gcount());
+ }
+
+ // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser.
+ int start = 0;
+ int delim;
+ while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
+ {
+
+ // Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
+ reset();
+
+ XML_ParserReset(parser, NULL);
+ XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
+ XML_SetCharacterDataHandler(parser, ExpatCharHandler);
+ XML_SetUserData(parser, this);
+ XML_Parse(parser, mInput.data() + start, delim - start, false);
+
+ // If this message isn't set to be squelched, output the raw XML received.
+ if(!squelchDebugOutput)
+ {
+ LL_DEBUGS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
+ }
+
+ start = delim + 3;
+ }
+
+ if(start != 0)
+ mInput = mInput.substr(start);
+
+ LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
+
+ if(!LLVivoxVoiceClient::getInstance()->mConnected)
+ {
+ // If voice has been disabled, we just want to close the socket. This does so.
+ LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
+ return STATUS_STOP;
+ }
+
+ return STATUS_OK;
+}
+
+void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
+{
+ if (data)
+ {
+ LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
+ object->StartTag(el, attr);
+ }
+}
+
+// --------------------------------------------------------------------------------
+
+void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
+{
+ if (data)
+ {
+ LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
+ object->EndTag(el);
+ }
+}
+
+// --------------------------------------------------------------------------------
+
+void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
+{
+ if (data)
+ {
+ LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
+ object->CharData(s, len);
+ }
+}
+
+// --------------------------------------------------------------------------------
+
+
+void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
+{
+ // Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
+ textBuffer.clear();
+ // only accumulate text if we're not ignoring tags.
+ accumulateText = !ignoringTags;
+
+ if (responseDepth == 0)
+ {
+ isEvent = !stricmp("Event", tag);
+
+ if (!stricmp("Response", tag) || isEvent)
+ {
+ // Grab the attributes
+ while (*attr)
+ {
+ const char *key = *attr++;
+ const char *value = *attr++;
+
+ if (!stricmp("requestId", key))
+ {
+ requestId = value;
+ }
+ else if (!stricmp("action", key))
+ {
+ actionString = value;
+ }
+ else if (!stricmp("type", key))
+ {
+ eventTypeString = value;
+ }
+ }
+ }
+ LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
+ }
+ else
+ {
+ if (ignoringTags)
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
+
+ // Ignore the InputXml stuff so we don't get confused
+ if (!stricmp("InputXml", tag))
+ {
+ ignoringTags = true;
+ ignoreDepth = responseDepth;
+ accumulateText = false;
+
+ LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
+ }
+ else if (!stricmp("CaptureDevices", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->clearCaptureDevices();
+ }
+ else if (!stricmp("RenderDevices", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->clearRenderDevices();
+ }
+ else if (!stricmp("CaptureDevice", tag))
+ {
+ deviceString.clear();
+ }
+ else if (!stricmp("RenderDevice", tag))
+ {
+ deviceString.clear();
+ }
+ else if (!stricmp("Buddies", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->deleteAllBuddies();
+ }
+ else if (!stricmp("BlockRules", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->deleteAllBlockRules();
+ }
+ else if (!stricmp("AutoAcceptRules", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->deleteAllAutoAcceptRules();
+ }
+
+ }
+ }
+ responseDepth++;
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::EndTag(const char *tag)
+{
+ const std::string& string = textBuffer;
+
+ responseDepth--;
+
+ if (ignoringTags)
+ {
+ if (ignoreDepth == responseDepth)
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
+ ignoringTags = false;
+ }
+ else
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+ }
+ }
+
+ if (!ignoringTags)
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+
+ // Closing a tag. Finalize the text we've accumulated and reset
+ if (!stricmp("ReturnCode", tag))
+ returnCode = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("SessionHandle", tag))
+ sessionHandle = string;
+ else if (!stricmp("SessionGroupHandle", tag))
+ sessionGroupHandle = string;
+ else if (!stricmp("StatusCode", tag))
+ statusCode = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("StatusString", tag))
+ statusString = string;
+ else if (!stricmp("ParticipantURI", tag))
+ uriString = string;
+ else if (!stricmp("Volume", tag))
+ volume = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("Energy", tag))
+ energy = (F32)strtod(string.c_str(), NULL);
+ else if (!stricmp("IsModeratorMuted", tag))
+ isModeratorMuted = !stricmp(string.c_str(), "true");
+ else if (!stricmp("IsSpeaking", tag))
+ isSpeaking = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Alias", tag))
+ alias = string;
+ else if (!stricmp("NumberOfAliases", tag))
+ numberOfAliases = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("Application", tag))
+ applicationString = string;
+ else if (!stricmp("ConnectorHandle", tag))
+ connectorHandle = string;
+ else if (!stricmp("VersionID", tag))
+ versionID = string;
+ else if (!stricmp("AccountHandle", tag))
+ accountHandle = string;
+ else if (!stricmp("State", tag))
+ state = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("URI", tag))
+ uriString = string;
+ else if (!stricmp("IsChannel", tag))
+ isChannel = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Incoming", tag))
+ incoming = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Enabled", tag))
+ enabled = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Name", tag))
+ nameString = string;
+ else if (!stricmp("AudioMedia", tag))
+ audioMediaString = string;
+ else if (!stricmp("ChannelName", tag))
+ nameString = string;
+ else if (!stricmp("DisplayName", tag))
+ displayNameString = string;
+ else if (!stricmp("Device", tag))
+ deviceString = string;
+ else if (!stricmp("AccountName", tag))
+ nameString = string;
+ else if (!stricmp("ParticipantType", tag))
+ participantType = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("IsLocallyMuted", tag))
+ isLocallyMuted = !stricmp(string.c_str(), "true");
+ else if (!stricmp("MicEnergy", tag))
+ energy = (F32)strtod(string.c_str(), NULL);
+ else if (!stricmp("ChannelName", tag))
+ nameString = string;
+ else if (!stricmp("ChannelURI", tag))
+ uriString = string;
+ else if (!stricmp("BuddyURI", tag))
+ uriString = string;
+ else if (!stricmp("Presence", tag))
+ statusString = string;
+ else if (!stricmp("CaptureDevice", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addCaptureDevice(deviceString);
+ }
+ else if (!stricmp("RenderDevice", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addRenderDevice(deviceString);
+ }
+ else if (!stricmp("Buddy", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->processBuddyListEntry(uriString, displayNameString);
+ }
+ else if (!stricmp("BlockRule", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addBlockRule(blockMask, presenceOnly);
+ }
+ else if (!stricmp("BlockMask", tag))
+ blockMask = string;
+ else if (!stricmp("PresenceOnly", tag))
+ presenceOnly = string;
+ else if (!stricmp("AutoAcceptRule", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
+ }
+ else if (!stricmp("AutoAcceptMask", tag))
+ autoAcceptMask = string;
+ else if (!stricmp("AutoAddAsBuddy", tag))
+ autoAddAsBuddy = string;
+ else if (!stricmp("MessageHeader", tag))
+ messageHeader = string;
+ else if (!stricmp("MessageBody", tag))
+ messageBody = string;
+ else if (!stricmp("NotificationType", tag))
+ notificationType = string;
+ else if (!stricmp("HasText", tag))
+ hasText = !stricmp(string.c_str(), "true");
+ else if (!stricmp("HasAudio", tag))
+ hasAudio = !stricmp(string.c_str(), "true");
+ else if (!stricmp("HasVideo", tag))
+ hasVideo = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Terminated", tag))
+ terminated = !stricmp(string.c_str(), "true");
+ else if (!stricmp("SubscriptionHandle", tag))
+ subscriptionHandle = string;
+ else if (!stricmp("SubscriptionType", tag))
+ subscriptionType = string;
+
+
+ textBuffer.clear();
+ accumulateText= false;
+
+ if (responseDepth == 0)
+ {
+ // We finished all of the XML, process the data
+ processResponse(tag);
+ }
+ }
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::CharData(const char *buffer, int length)
+{
+ /*
+ This method is called for anything that isn't a tag, which can be text you
+ want that lies between tags, and a lot of stuff you don't want like file formatting
+ (tabs, spaces, CR/LF, etc).
+
+ Only copy text if we are in accumulate mode...
+ */
+ if (accumulateText)
+ textBuffer.append(buffer, length);
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::processResponse(std::string tag)
+{
+ LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
+
+ // SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success. This is a change vs. previous SDKs.
+ // According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
+ // so I believe this will give correct behavior.
+
+ if(returnCode == 0)
+ statusCode = 0;
+
+ if (isEvent)
+ {
+ const char *eventTypeCstr = eventTypeString.c_str();
+ if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
+ {
+ /*
+ <Event type="SessionAddedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+ <Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
+ <IsChannel>true</IsChannel>
+ <Incoming>false</Incoming>
+ <ChannelName />
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionGroupAddedEvent(sessionGroupHandle);
+ }
+ else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
+ {
+ /*
+ <Event type="MediaStreamUpdatedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+ <StatusCode>200</StatusCode>
+ <StatusString>OK</StatusString>
+ <State>2</State>
+ <Incoming>false</Incoming>
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
+ }
+ else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
+ {
+ /*
+ <Event type="TextStreamUpdatedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==1</SessionHandle>
+ <Enabled>true</Enabled>
+ <State>1</State>
+ <Incoming>true</Incoming>
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
+ }
+ else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
+ {
+ /*
+ <Event type="ParticipantAddedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+ <ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
+ <AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
+ <DisplayName />
+ <ParticipantType>0</ParticipantType>
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
+ }
+ else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
+ {
+ /*
+ <Event type="ParticipantRemovedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+ <ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
+ <AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
+ }
+ else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
+ {
+ /*
+ <Event type="ParticipantUpdatedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+ <ParticipantUri>sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com</ParticipantUri>
+ <IsModeratorMuted>false</IsModeratorMuted>
+ <IsSpeaking>true</IsSpeaking>
+ <Volume>44</Volume>
+ <Energy>0.0879437</Energy>
+ </Event>
+ */
+
+ // These happen so often that logging them is pretty useless.
+ squelchDebugOutput = true;
+
+ LLVivoxVoiceClient::getInstance()->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
+ }
+ else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->auxAudioPropertiesEvent(energy);
+ }
+ else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->buddyPresenceEvent(uriString, alias, statusString, applicationString);
+ }
+ else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
+ {
+ // The buddy list was updated during parsing.
+ // Need to recheck against the friends list.
+ LLVivoxVoiceClient::getInstance()->buddyListChanged();
+ }
+ else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
+ {
+ /*
+ <Event type="BuddyChangedEvent">
+ <AccountHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==</AccountHandle>
+ <BuddyURI>sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com</BuddyURI>
+ <DisplayName>Monroe Tester</DisplayName>
+ <BuddyData />
+ <GroupID>0</GroupID>
+ <ChangeType>Set</ChangeType>
+ </Event>
+ */
+ // TODO: Question: Do we need to process this at all?
+ }
+ else if (!stricmp(eventTypeCstr, "MessageEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionNotificationEvent(sessionHandle, uriString, notificationType);
+ }
+ else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))
+ {
+ /*
+ <Event type="SessionUpdatedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+ <Uri>sip:confctl-9@bhd.vivox.com</Uri>
+ <IsMuted>0</IsMuted>
+ <Volume>50</Volume>
+ <TransmitEnabled>1</TransmitEnabled>
+ <IsFocused>0</IsFocused>
+ <SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
+ <SessionFontID>0</SessionFontID>
+ </Event>
+ */
+ // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+ }
+
+ else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))
+ {
+ /*
+ <Event type="SessionGroupRemovedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ </Event>
+ */
+ // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+ }
+ else
+ {
+ LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
+ }
+ }
+ else
+ {
+ const char *actionCstr = actionString.c_str();
+ if (!stricmp(actionCstr, "Connector.Create.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
+ }
+ else if (!stricmp(actionCstr, "Account.Login.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
+ }
+ else if (!stricmp(actionCstr, "Session.Create.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);
+ }
+ else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);
+ }
+ else if (!stricmp(actionCstr, "Session.Connect.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionConnectResponse(requestId, statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Account.Logout.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->logoutResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->connectorShutdownResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->accountListBlockRulesResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->accountListAutoAcceptRulesResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
+ {
+ // We don't need to process these, but they're so spammy we don't want to log them.
+ squelchDebugOutput = true;
+ }
+ /*
+ else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
+ {
+ LLVoiceClient::getInstance()->channelGetListResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
+ {
+
+ }
+ */
+ }
+}
+
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
new file mode 100644
index 0000000000..59fec8b954
--- /dev/null
+++ b/indra/newview/llvoicevivox.h
@@ -0,0 +1,917 @@
+/**
+ * @file llvoicevivox.h
+ * @brief Declaration of LLDiamondwareVoiceClient class which is the interface to the voice client process.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2010, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#ifndef LL_VOICE_VIVOX_H
+#define LL_VOICE_VIVOX_H
+
+class LLVOAvatar;
+class LLVivoxProtocolParser;
+
+#include "lliopipe.h"
+#include "llpumpio.h"
+#include "llchainio.h"
+#include "lliosocket.h"
+#include "v3math.h"
+#include "llframetimer.h"
+#include "llviewerregion.h"
+#include "llcallingcard.h" // for LLFriendObserver
+
+#ifdef LL_STANDALONE
+# include "expat.h"
+#else
+# include "expat/expat.h"
+#endif
+#include "llvoiceclient.h"
+
+
+class LLVivoxVoiceAccountProvisionResponder;
+class LLVivoxVoiceClientMuteListObserver;
+class LLVivoxVoiceClientFriendsObserver;
+
+
+class LLVivoxVoiceClientParticipantObserver
+{
+public:
+ virtual ~LLVivoxVoiceClientParticipantObserver() { }
+ virtual void onChange() = 0;
+};
+
+
+class LLVivoxVoiceClient: public LLSingleton<LLVivoxVoiceClient>, virtual public LLVoiceModuleInterface
+{
+ LOG_CLASS(LLVivoxVoiceClient);
+public:
+ LLVivoxVoiceClient();
+ virtual ~LLVivoxVoiceClient();
+
+
+ /// @name LLVoiceModuleInterface virtual implementations
+ /// @see LLVoiceModuleInterface
+ //@{
+ virtual void init(LLPumpIO *pump); // Call this once at application startup (creates connector)
+ virtual void terminate(); // Call this to clean up during shutdown
+
+ virtual const LLVoiceVersionInfo& getVersion();
+
+ virtual void updateSettings(); // call after loading settings and whenever they change
+
+ // Returns true if vivox has successfully logged in and is not in error state
+ virtual bool isVoiceWorking();
+
+ /////////////////////
+ /// @name Tuning
+ //@{
+ virtual void tuningStart();
+ virtual void tuningStop();
+ virtual bool inTuningMode();
+
+ virtual void tuningSetMicVolume(float volume);
+ virtual void tuningSetSpeakerVolume(float volume);
+ virtual float tuningGetEnergy(void);
+ //@}
+
+ /////////////////////
+ /// @name Devices
+ //@{
+ // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+ // i.e. when the daemon is running and connected, and the device lists are populated.
+ virtual bool deviceSettingsAvailable();
+
+ // Requery the vivox daemon for the current list of input/output devices.
+ // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+ // (use this if you want to know when it's done).
+ // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+ virtual void refreshDeviceLists(bool clearCurrentList = true);
+
+ virtual void setCaptureDevice(const std::string& name);
+ virtual void setRenderDevice(const std::string& name);
+
+ virtual LLVoiceDeviceList& getCaptureDevices();
+ virtual LLVoiceDeviceList& getRenderDevices();
+ //@}
+
+ virtual void getParticipantList(std::set<LLUUID> &participants);
+ virtual bool isParticipant(const LLUUID& speaker_id);
+
+ // Send a text message to the specified user, initiating the session if necessary.
+ virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message);
+
+ // close any existing text IM session with the specified user
+ virtual void endUserIMSession(const LLUUID &uuid);
+
+ // Returns true if calling back the session URI after the session has closed is possible.
+ // Currently this will be false only for PSTN P2P calls.
+ // NOTE: this will return true if the session can't be found.
+ virtual BOOL isSessionCallBackPossible(const LLUUID &session_id);
+
+ // Returns true if the session can accepte text IM's.
+ // Currently this will be false only for PSTN P2P calls.
+ // NOTE: this will return true if the session can't be found.
+ virtual BOOL isSessionTextIMPossible(const LLUUID &session_id);
+
+
+ ////////////////////////////
+ /// @name Channel stuff
+ //@{
+ // returns true iff the user is currently in a proximal (local spatial) channel.
+ // Note that gestures should only fire if this returns true.
+ virtual bool inProximalChannel();
+
+ virtual void setNonSpatialChannel(const std::string &uri,
+ const std::string &credentials);
+
+ virtual void setSpatialChannel(const std::string &uri,
+ const std::string &credentials);
+
+ virtual void leaveNonSpatialChannel();
+
+ virtual void leaveChannel(void);
+
+ // Returns the URI of the current channel, or an empty string if not currently in a channel.
+ // NOTE that it will return an empty string if it's in the process of joining a channel.
+ virtual std::string getCurrentChannel();
+ //@}
+
+
+ //////////////////////////
+ /// @name invitations
+ //@{
+ // start a voice channel with the specified user
+ virtual void callUser(const LLUUID &uuid);
+ virtual bool isValidChannel(std::string &channelHandle);
+ virtual bool answerInvite(std::string &channelHandle);
+ virtual void declineInvite(std::string &channelHandle);
+ //@}
+
+ /////////////////////////
+ /// @name Volume/gain
+ //@{
+ virtual void setVoiceVolume(F32 volume);
+ virtual void setMicGain(F32 volume);
+ //@}
+
+ /////////////////////////
+ /// @name enable disable voice and features
+ //@{
+ virtual bool voiceEnabled();
+ virtual void setVoiceEnabled(bool enabled);
+ virtual BOOL lipSyncEnabled();
+ virtual void setLipSyncEnabled(BOOL enabled);
+ virtual void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+ //@}
+
+ ////////////////////////
+ /// @name PTT
+ //@{
+ virtual void setUserPTTState(bool ptt);
+ virtual bool getUserPTTState();
+ virtual void setUsePTT(bool usePTT);
+ virtual void setPTTIsToggle(bool PTTIsToggle);
+ virtual bool getPTTIsToggle();
+ virtual void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+ virtual void toggleUserPTTState(void);
+
+ virtual void keyDown(KEY key, MASK mask);
+ virtual void keyUp(KEY key, MASK mask);
+ virtual void middleMouseState(bool down);
+ //@}
+
+ //////////////////////////
+ /// @name nearby speaker accessors
+ //@{
+ virtual BOOL getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar
+ virtual std::string getDisplayName(const LLUUID& id);
+ virtual BOOL isOnlineSIP(const LLUUID &id);
+ virtual BOOL isParticipantAvatar(const LLUUID &id);
+ virtual BOOL getIsSpeaking(const LLUUID& id);
+ virtual BOOL getIsModeratorMuted(const LLUUID& id);
+ virtual F32 getCurrentPower(const LLUUID& id); // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
+ virtual BOOL getOnMuteList(const LLUUID& id);
+ virtual F32 getUserVolume(const LLUUID& id);
+ virtual void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)
+ //@}
+
+ // authorize the user
+ virtual void userAuthorized(const std::string& user_id,
+ const LLUUID &agentID);
+
+ //////////////////////////////
+ /// @name Status notification
+ //@{
+ virtual void addObserver(LLVoiceClientStatusObserver* observer);
+ virtual void removeObserver(LLVoiceClientStatusObserver* observer);
+ virtual void addObserver(LLFriendObserver* observer);
+ virtual void removeObserver(LLFriendObserver* observer);
+ virtual void addObserver(LLVoiceClientParticipantObserver* observer);
+ virtual void removeObserver(LLVoiceClientParticipantObserver* observer);
+
+
+
+ //@}
+
+ virtual std::string sipURIFromID(const LLUUID &id);
+ //@}
+
+
+protected:
+ //////////////////////
+ // Vivox Specific definitions
+
+ friend class LLVivoxVoiceAccountProvisionResponder;
+ friend class LLVivoxVoiceClientMuteListObserver;
+ friend class LLVivoxVoiceClientFriendsObserver;
+
+ enum streamState
+ {
+ streamStateUnknown = 0,
+ streamStateIdle = 1,
+ streamStateConnected = 2,
+ streamStateRinging = 3,
+ };
+ struct participantState
+ {
+ public:
+ participantState(const std::string &uri);
+
+ bool updateMuteState(); // true if mute state has changed
+ bool isAvatar();
+
+ std::string mURI;
+ LLUUID mAvatarID;
+ std::string mAccountName;
+ std::string mDisplayName;
+ LLFrameTimer mSpeakingTimeout;
+ F32 mLastSpokeTimestamp;
+ F32 mPower;
+ F32 mVolume;
+ std::string mGroupID;
+ int mUserVolume;
+ bool mPTT;
+ bool mIsSpeaking;
+ bool mIsModeratorMuted;
+ bool mOnMuteList; // true if this avatar is on the user's mute list (and should be muted)
+ bool mVolumeSet; // true if incoming volume messages should not change the volume
+ bool mVolumeDirty; // true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
+ bool mAvatarIDValid;
+ bool mIsSelf;
+ };
+
+ typedef std::map<const std::string, participantState*> participantMap;
+
+ typedef std::map<const LLUUID, participantState*> participantUUIDMap;
+
+ struct sessionState
+ {
+ public:
+ sessionState();
+ ~sessionState();
+
+ participantState *addParticipant(const std::string &uri);
+ // Note: after removeParticipant returns, the participant* that was passed to it will have been deleted.
+ // Take care not to use the pointer again after that.
+ void removeParticipant(participantState *participant);
+ void removeAllParticipants();
+
+ participantState *findParticipant(const std::string &uri);
+ participantState *findParticipantByID(const LLUUID& id);
+
+ bool isCallBackPossible();
+ bool isTextIMPossible();
+
+ std::string mHandle;
+ std::string mGroupHandle;
+ std::string mSIPURI;
+ std::string mAlias;
+ std::string mName;
+ std::string mAlternateSIPURI;
+ std::string mHash; // Channel password
+ std::string mErrorStatusString;
+ std::queue<std::string> mTextMsgQueue;
+
+ LLUUID mIMSessionID;
+ LLUUID mCallerID;
+ int mErrorStatusCode;
+ int mMediaStreamState;
+ int mTextStreamState;
+ bool mCreateInProgress; // True if a Session.Create has been sent for this session and no response has been received yet.
+ bool mMediaConnectInProgress; // True if a Session.MediaConnect has been sent for this session and no response has been received yet.
+ bool mVoiceInvitePending; // True if a voice invite is pending for this session (usually waiting on a name lookup)
+ bool mTextInvitePending; // True if a text invite is pending for this session (usually waiting on a name lookup)
+ bool mSynthesizedCallerID; // True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
+ bool mIsChannel; // True for both group and spatial channels (false for p2p, PSTN)
+ bool mIsSpatial; // True for spatial channels
+ bool mIsP2P;
+ bool mIncoming;
+ bool mVoiceEnabled;
+ bool mReconnect; // Whether we should try to reconnect to this session if it's dropped
+ // Set to true when the mute state of someone in the participant list changes.
+ // The code will have to walk the list to find the changed participant(s).
+ bool mVolumeDirty;
+ bool mMuteDirty;
+
+ bool mParticipantsChanged;
+ participantMap mParticipantsByURI;
+ participantUUIDMap mParticipantsByUUID;
+ };
+
+ // internal state for a simple state machine. This is used to deal with the asynchronous nature of some of the messages.
+ // Note: if you change this list, please make corresponding changes to LLVivoxVoiceClient::state2string().
+ enum state
+ {
+ stateDisableCleanup,
+ stateDisabled, // Voice is turned off.
+ stateStart, // Class is initialized, socket is created
+ stateDaemonLaunched, // Daemon has been launched
+ stateConnecting, // connect() call has been issued
+ stateConnected, // connection to the daemon has been made, send some initial setup commands.
+ stateIdle, // socket is connected, ready for messaging
+ stateMicTuningStart,
+ stateMicTuningRunning,
+ stateMicTuningStop,
+ stateConnectorStart, // connector needs to be started
+ stateConnectorStarting, // waiting for connector handle
+ stateConnectorStarted, // connector handle received
+ stateLoginRetry, // need to retry login (failed due to changing password)
+ stateLoginRetryWait, // waiting for retry timer
+ stateNeedsLogin, // send login request
+ stateLoggingIn, // waiting for account handle
+ stateLoggedIn, // account handle received
+ stateCreatingSessionGroup, // Creating the main session group
+ stateNoChannel, //
+ stateJoiningSession, // waiting for session handle
+ stateSessionJoined, // session handle received
+ stateRunning, // in session, steady state
+ stateLeavingSession, // waiting for terminate session response
+ stateSessionTerminated, // waiting for terminate session response
+
+ stateLoggingOut, // waiting for logout response
+ stateLoggedOut, // logout response received
+ stateConnectorStopping, // waiting for connector stop
+ stateConnectorStopped, // connector stop received
+
+ // We go to this state if the login fails because the account needs to be provisioned.
+
+ // error states. No way to recover from these yet.
+ stateConnectorFailed,
+ stateConnectorFailedWaiting,
+ stateLoginFailed,
+ stateLoginFailedWaiting,
+ stateJoinSessionFailed,
+ stateJoinSessionFailedWaiting,
+
+ stateJail // Go here when all else has failed. Nothing will be retried, we're done.
+ };
+
+ typedef std::map<std::string, sessionState*> sessionMap;
+
+
+
+ ///////////////////////////////////////////////////////
+ // Private Member Functions
+ //////////////////////////////////////////////////////
+
+ //////////////////////////////
+ /// @name TVC/Server management and communication
+ //@{
+ // Call this if the connection to the daemon terminates unexpectedly. It will attempt to reset everything and relaunch.
+ void daemonDied();
+
+ // Call this if we're just giving up on voice (can't provision an account, etc.). It will clean up and go away.
+ void giveUp();
+
+ // write to the tvc
+ bool writeString(const std::string &str);
+
+ void connectorCreate();
+ void connectorShutdown();
+ void closeSocket(void);
+
+ void requestVoiceAccountProvision(S32 retries = 3);
+ void login(
+ const std::string& account_name,
+ const std::string& password,
+ const std::string& voice_sip_uri_hostname,
+ const std::string& voice_account_server_uri);
+ void loginSendMessage();
+ void logout();
+ void logoutSendMessage();
+
+
+ //@}
+
+ //------------------------------------
+ // tuning
+
+ void tuningRenderStartSendMessage(const std::string& name, bool loop);
+ void tuningRenderStopSendMessage();
+
+ void tuningCaptureStartSendMessage(int duration);
+ void tuningCaptureStopSendMessage();
+
+ bool inTuningStates();
+
+ //----------------------------------
+ // devices
+ void clearCaptureDevices();
+ void addCaptureDevice(const std::string& name);
+ void clearRenderDevices();
+ void addRenderDevice(const std::string& name);
+ void buildSetAudioDevices(std::ostringstream &stream);
+
+ void getCaptureDevicesSendMessage();
+ void getRenderDevicesSendMessage();
+
+ // local audio updates
+ void buildLocalAudioUpdates(std::ostringstream &stream);
+
+
+ /////////////////////////////
+ // Response/Event handlers
+ void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
+ void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
+ void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+ void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+ void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
+ void logoutResponse(int statusCode, std::string &statusString);
+ void connectorShutdownResponse(int statusCode, std::string &statusString);
+
+ void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
+ void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
+ void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming);
+ void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
+ void sessionGroupAddedEvent(std::string &sessionGroupHandle);
+ void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
+ void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
+ void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
+ void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
+ void auxAudioPropertiesEvent(F32 energy);
+ void buddyPresenceEvent(std::string &uriString, std::string &alias, std::string &statusString, std::string &applicationString);
+ void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
+ void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
+ void subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType);
+
+ void buddyListChanged();
+ void muteListChanged();
+ void updateFriends(U32 mask);
+
+ /////////////////////////////
+ // Sending updates of current state
+ void updatePosition(void);
+ void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+ void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+ bool channelFromRegion(LLViewerRegion *region, std::string &name);
+
+ void setEarLocation(S32 loc);
+
+
+ /////////////////////////////
+ // Accessors for data related to nearby speakers
+
+ // MBW -- XXX -- Not sure how to get this data out of the TVC
+ BOOL getUsingPTT(const LLUUID& id);
+ std::string getGroupID(const LLUUID& id); // group ID if the user is in group chat (empty string if not applicable)
+
+ /////////////////////////////
+ BOOL getAreaVoiceDisabled(); // returns true if the area the avatar is in is speech-disabled.
+ // Use this to determine whether to show a "no speech" icon in the menu bar.
+
+
+ // PTT
+ void setPTTKey(std::string &key);
+
+ /////////////////////////////
+ // Recording controls
+ void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
+ void recordingLoopSave(const std::string& filename);
+ void recordingStop();
+
+ // Playback controls
+ void filePlaybackStart(const std::string& filename);
+ void filePlaybackStop();
+ void filePlaybackSetPaused(bool paused);
+ void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
+
+ participantState *findParticipantByID(const LLUUID& id);
+
+
+ ////////////////////////////////////////
+ // voice sessions.
+ typedef std::set<sessionState*> sessionSet;
+
+ typedef sessionSet::iterator sessionIterator;
+ sessionIterator sessionsBegin(void);
+ sessionIterator sessionsEnd(void);
+
+ sessionState *findSession(const std::string &handle);
+ sessionState *findSessionBeingCreatedByURI(const std::string &uri);
+ sessionState *findSession(const LLUUID &participant_id);
+ sessionState *findSessionByCreateID(const std::string &create_id);
+
+ sessionState *addSession(const std::string &uri, const std::string &handle = LLStringUtil::null);
+ void setSessionHandle(sessionState *session, const std::string &handle = LLStringUtil::null);
+ void setSessionURI(sessionState *session, const std::string &uri);
+ void deleteSession(sessionState *session);
+ void deleteAllSessions(void);
+
+ void verifySessionState(void);
+
+ void joinedAudioSession(sessionState *session);
+ void leftAudioSession(sessionState *session);
+
+ // This is called in several places where the session _may_ need to be deleted.
+ // It contains logic for whether to delete the session or keep it around.
+ void reapSession(sessionState *session);
+
+ // Returns true if the session seems to indicate we've moved to a region on a different voice server
+ bool sessionNeedsRelog(sessionState *session);
+
+
+ //////////////////////////////////////
+ // buddy list stuff, needed for SLIM later
+ struct buddyListEntry
+ {
+ buddyListEntry(const std::string &uri);
+ std::string mURI;
+ std::string mDisplayName;
+ LLUUID mUUID;
+ bool mOnlineSL;
+ bool mOnlineSLim;
+ bool mCanSeeMeOnline;
+ bool mHasBlockListEntry;
+ bool mHasAutoAcceptListEntry;
+ bool mNameResolved;
+ bool mInSLFriends;
+ bool mInVivoxBuddies;
+ bool mNeedsNameUpdate;
+ };
+
+ typedef std::map<std::string, buddyListEntry*> buddyListMap;
+
+ // This should be called when parsing a buddy list entry sent by SLVoice.
+ void processBuddyListEntry(const std::string &uri, const std::string &displayName);
+
+ buddyListEntry *addBuddy(const std::string &uri);
+ buddyListEntry *addBuddy(const std::string &uri, const std::string &displayName);
+ buddyListEntry *findBuddy(const std::string &uri);
+ buddyListEntry *findBuddy(const LLUUID &id);
+ buddyListEntry *findBuddyByDisplayName(const std::string &name);
+ void deleteBuddy(const std::string &uri);
+ void deleteAllBuddies(void);
+
+ void deleteAllBlockRules(void);
+ void addBlockRule(const std::string &blockMask, const std::string &presenceOnly);
+ void deleteAllAutoAcceptRules(void);
+ void addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy);
+ void accountListBlockRulesResponse(int statusCode, const std::string &statusString);
+ void accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString);
+
+ /////////////////////////////
+ // session control messages
+
+ void accountListBlockRulesSendMessage();
+ void accountListAutoAcceptRulesSendMessage();
+
+ void sessionGroupCreateSendMessage();
+ void sessionCreateSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+ void sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+ void sessionMediaConnectSendMessage(sessionState *session); // just joins the audio session
+ void sessionTextConnectSendMessage(sessionState *session); // just joins the text session
+ void sessionTerminateSendMessage(sessionState *session);
+ void sessionGroupTerminateSendMessage(sessionState *session);
+ void sessionMediaDisconnectSendMessage(sessionState *session);
+ void sessionTextDisconnectSendMessage(sessionState *session);
+
+ // Pokes the state machine to leave the audio session next time around.
+ void sessionTerminate();
+
+ // Pokes the state machine to shut down the connector and restart it.
+ void requestRelog();
+
+ // Does the actual work to get out of the audio session
+ void leaveAudioSession();
+
+ void lookupName(const LLUUID &id);
+ static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
+ void avatarNameResolved(const LLUUID &id, const std::string &name);
+
+private:
+ LLVoiceVersionInfo mVoiceVersion;
+
+ state mState;
+ bool mSessionTerminateRequested;
+ bool mRelogRequested;
+ // Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine().
+ // The larger it is the greater is possibility there is a problem with connection to voice server.
+ // Introduced while fixing EXT-4313.
+ int mSpatialJoiningNum;
+
+ void setState(state inState);
+ state getState(void) { return mState; };
+ std::string state2string(state inState);
+
+ void stateMachine();
+ static void idle(void *user_data);
+
+ LLHost mDaemonHost;
+ LLSocket::ptr_t mSocket;
+ bool mConnected;
+
+
+ LLPumpIO *mPump;
+ friend class LLVivoxProtocolParser;
+
+ std::string mAccountName;
+ std::string mAccountPassword;
+ std::string mAccountDisplayName;
+
+ bool mTuningMode;
+ float mTuningEnergy;
+ std::string mTuningAudioFile;
+ int mTuningMicVolume;
+ bool mTuningMicVolumeDirty;
+ int mTuningSpeakerVolume;
+ bool mTuningSpeakerVolumeDirty;
+ state mTuningExitState; // state to return to when we leave tuning mode.
+
+ std::string mSpatialSessionURI;
+ std::string mSpatialSessionCredentials;
+
+ std::string mMainSessionGroupHandle; // handle of the "main" session group.
+
+ std::string mChannelName; // Name of the channel to be looked up
+ bool mAreaVoiceDisabled;
+ sessionState *mAudioSession; // Session state for the current audio session
+ bool mAudioSessionChanged; // set to true when the above pointer gets changed, so observers can be notified.
+
+ sessionState *mNextAudioSession; // Session state for the audio session we're trying to join
+
+// std::string mSessionURI; // URI of the session we're in.
+// std::string mSessionHandle; // returned by ?
+
+ S32 mCurrentParcelLocalID; // Used to detect parcel boundary crossings
+ std::string mCurrentRegionName; // Used to detect parcel boundary crossings
+
+ std::string mConnectorHandle; // returned by "Create Connector" message
+ std::string mAccountHandle; // returned by login message
+ int mNumberOfAliases;
+ U32 mCommandCookie;
+
+ std::string mVoiceAccountServerURI;
+ std::string mVoiceSIPURIHostName;
+
+ int mLoginRetryCount;
+
+ sessionMap mSessionsByHandle; // Active sessions, indexed by session handle. Sessions which are being initiated may not be in this map.
+ sessionSet mSessions; // All sessions, not indexed. This is the canonical session list.
+
+ bool mBuddyListMapPopulated;
+ bool mBlockRulesListReceived;
+ bool mAutoAcceptRulesListReceived;
+ buddyListMap mBuddyListMap;
+
+ LLVoiceDeviceList mCaptureDevices;
+ LLVoiceDeviceList mRenderDevices;
+
+ std::string mCaptureDevice;
+ std::string mRenderDevice;
+ bool mCaptureDeviceDirty;
+ bool mRenderDeviceDirty;
+
+ // This should be called when the code detects we have changed parcels.
+ // It initiates the call to the server that gets the parcel channel.
+ void parcelChanged();
+
+ void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
+ void joinSession(sessionState *session);
+
+ std::string nameFromAvatar(LLVOAvatar *avatar);
+ std::string nameFromID(const LLUUID &id);
+ bool IDFromName(const std::string name, LLUUID &uuid);
+ std::string displayNameFromAvatar(LLVOAvatar *avatar);
+ std::string sipURIFromAvatar(LLVOAvatar *avatar);
+ std::string sipURIFromName(std::string &name);
+
+ // Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
+ std::string nameFromsipURI(const std::string &uri);
+
+ bool inSpatialChannel(void);
+ std::string getAudioSessionURI();
+ std::string getAudioSessionHandle();
+
+ void sendPositionalUpdate(void);
+
+ void buildSetCaptureDevice(std::ostringstream &stream);
+ void buildSetRenderDevice(std::ostringstream &stream);
+
+ void clearAllLists();
+ void checkFriend(const LLUUID& id);
+ void sendFriendsListUpdates();
+
+ // start a text IM session with the specified user
+ // This will be asynchronous, the session may be established at a future time.
+ sessionState* startUserIMSession(const LLUUID& uuid);
+ void sendQueuedTextMessages(sessionState *session);
+
+ void enforceTether(void);
+
+ bool mSpatialCoordsDirty;
+
+ LLVector3d mCameraPosition;
+ LLVector3d mCameraRequestedPosition;
+ LLVector3 mCameraVelocity;
+ LLMatrix3 mCameraRot;
+
+ LLVector3d mAvatarPosition;
+ LLVector3 mAvatarVelocity;
+ LLMatrix3 mAvatarRot;
+
+ bool mPTTDirty;
+ bool mPTT;
+
+ bool mUsePTT;
+ bool mPTTIsMiddleMouse;
+ KEY mPTTKey;
+ bool mPTTIsToggle;
+ bool mUserPTTState;
+ bool mMuteMic;
+
+ // Set to true when the friends list is known to have changed.
+ bool mFriendsListDirty;
+
+ enum
+ {
+ earLocCamera = 0, // ear at camera
+ earLocAvatar, // ear at avatar
+ earLocMixed // ear at avatar location/camera direction
+ };
+
+ S32 mEarLocation;
+
+ bool mSpeakerVolumeDirty;
+ bool mSpeakerMuteDirty;
+ int mSpeakerVolume;
+
+ int mMicVolume;
+ bool mMicVolumeDirty;
+
+ bool mVoiceEnabled;
+ bool mWriteInProgress;
+ std::string mWriteString;
+ size_t mWriteOffset;
+
+ LLTimer mUpdateTimer;
+
+ BOOL mLipSyncEnabled;
+
+ typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
+ observer_set_t mParticipantObservers;
+
+ void notifyParticipantObservers();
+
+ typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
+ status_observer_set_t mStatusObservers;
+
+ void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
+
+ typedef std::set<LLFriendObserver*> friend_observer_set_t;
+ friend_observer_set_t mFriendObservers;
+ void notifyFriendObservers();
+};
+
+/**
+ * @class LLVivoxProtocolParser
+ * @brief This class helps construct new LLIOPipe specializations
+ * @see LLIOPipe
+ *
+ * THOROUGH_DESCRIPTION
+ */
+class LLVivoxProtocolParser : public LLIOPipe
+{
+ LOG_CLASS(LLVivoxProtocolParser);
+public:
+ LLVivoxProtocolParser();
+ virtual ~LLVivoxProtocolParser();
+
+protected:
+ /* @name LLIOPipe virtual implementations
+ */
+ //@{
+ /**
+ * @brief Process the data in buffer
+ */
+ virtual EStatus process_impl(
+ const LLChannelDescriptors& channels,
+ buffer_ptr_t& buffer,
+ bool& eos,
+ LLSD& context,
+ LLPumpIO* pump);
+ //@}
+
+ std::string mInput;
+
+ // Expat control members
+ XML_Parser parser;
+ int responseDepth;
+ bool ignoringTags;
+ bool isEvent;
+ int ignoreDepth;
+
+ // Members for processing responses. The values are transient and only valid within a call to processResponse().
+ bool squelchDebugOutput;
+ int returnCode;
+ int statusCode;
+ std::string statusString;
+ std::string requestId;
+ std::string actionString;
+ std::string connectorHandle;
+ std::string versionID;
+ std::string accountHandle;
+ std::string sessionHandle;
+ std::string sessionGroupHandle;
+ std::string alias;
+ std::string applicationString;
+
+ // Members for processing events. The values are transient and only valid within a call to processResponse().
+ std::string eventTypeString;
+ int state;
+ std::string uriString;
+ bool isChannel;
+ bool incoming;
+ bool enabled;
+ std::string nameString;
+ std::string audioMediaString;
+ std::string deviceString;
+ std::string displayNameString;
+ int participantType;
+ bool isLocallyMuted;
+ bool isModeratorMuted;
+ bool isSpeaking;
+ int volume;
+ F32 energy;
+ std::string messageHeader;
+ std::string messageBody;
+ std::string notificationType;
+ bool hasText;
+ bool hasAudio;
+ bool hasVideo;
+ bool terminated;
+ std::string blockMask;
+ std::string presenceOnly;
+ std::string autoAcceptMask;
+ std::string autoAddAsBuddy;
+ int numberOfAliases;
+ std::string subscriptionHandle;
+ std::string subscriptionType;
+
+
+ // Members for processing text between tags
+ std::string textBuffer;
+ bool accumulateText;
+
+ void reset();
+
+ void processResponse(std::string tag);
+
+ static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
+ static void XMLCALL ExpatEndTag(void *data, const char *el);
+ static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
+
+ void StartTag(const char *tag, const char **attr);
+ void EndTag(const char *tag);
+ void CharData(const char *buffer, int length);
+
+};
+
+
+#endif //LL_VIVOX_VOICE_CLIENT_H
+
+
+
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 594435475f..d6453111d7 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1856,6 +1856,11 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m
}
LLTextureEntry *te = getTE(texture_index);
+ if(!te)
+ {
+ return ;
+ }
+
LL_DEBUGS("MediaOnAPrim") << "BEFORE: texture_index = " << texture_index
<< " hasMedia = " << te->hasMedia() << " : "
<< ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl;
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index 63f99273fe..3ecd1296bd 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -88,7 +88,7 @@ static std::string asset_id_to_filename(const LLUUID &asset_id);
LLWearable::LLWearable(const LLTransactionID& transaction_id) :
mDefinitionVersion(LLWearable::sCurrentDefinitionVersion),
- mType(WT_INVALID)
+ mType(LLWearableType::WT_INVALID)
{
mTransactionID = transaction_id;
mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
@@ -96,7 +96,7 @@ LLWearable::LLWearable(const LLTransactionID& transaction_id) :
LLWearable::LLWearable(const LLAssetID& asset_id) :
mDefinitionVersion( LLWearable::sCurrentDefinitionVersion ),
- mType(WT_INVALID)
+ mType(LLWearableType::WT_INVALID)
{
mAssetID = asset_id;
mTransactionID.setNull();
@@ -108,17 +108,17 @@ LLWearable::~LLWearable()
const std::string& LLWearable::getTypeLabel() const
{
- return LLWearableDictionary::getTypeLabel(mType);
+ return LLWearableType::getTypeLabel(mType);
}
const std::string& LLWearable::getTypeName() const
{
- return LLWearableDictionary::getTypeName(mType);
+ return LLWearableType::getTypeName(mType);
}
LLAssetType::EType LLWearable::getAssetType() const
{
- return LLWearableDictionary::getAssetType(mType);
+ return LLWearableType::getAssetType(mType);
}
BOOL LLWearable::exportFile(LLFILE* file) const
@@ -363,13 +363,13 @@ BOOL LLWearable::importFile( LLFILE* file )
llwarns << "Bad Wearable asset: bad type" << llendl;
return FALSE;
}
- if( 0 <= type && type < WT_COUNT )
+ if( 0 <= type && type < LLWearableType::WT_COUNT )
{
- setType((EWearableType)type);
+ setType((LLWearableType::EType)type);
}
else
{
- mType = WT_COUNT;
+ mType = LLWearableType::WT_COUNT;
llwarns << "Bad Wearable asset: bad type #" << type << llendl;
return FALSE;
}
@@ -679,15 +679,15 @@ void LLWearable::writeToAvatar()
// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values.
// static
-void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
+void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake )
{
if (!isAgentAvatarValid()) return;
// You can't just remove body parts.
- if( (type == WT_SHAPE) ||
- (type == WT_SKIN) ||
- (type == WT_HAIR) ||
- (type == WT_EYES) )
+ if( (type == LLWearableType::WT_SHAPE) ||
+ (type == LLWearableType::WT_SKIN) ||
+ (type == LLWearableType::WT_HAIR) ||
+ (type == LLWearableType::WT_EYES) )
{
return;
}
@@ -789,7 +789,7 @@ const LLUUID& LLWearable::getItemID() const
return mItemID;
}
-void LLWearable::setType(EWearableType type)
+void LLWearable::setType(LLWearableType::EType type)
{
mType = type;
createVisualParams();
@@ -1118,7 +1118,7 @@ void LLWearable::refreshName()
struct LLWearableSaveData
{
- EWearableType mType;
+ LLWearableType::EType mType;
};
void LLWearable::saveNewAsset() const
@@ -1181,7 +1181,7 @@ void LLWearable::saveNewAsset() const
void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLWearableSaveData* data = (LLWearableSaveData*)userdata;
- const std::string& type_name = LLWearableDictionary::getTypeName(data->mType);
+ const std::string& type_name = LLWearableType::getTypeName(data->mType);
if(0 == status)
{
// Success
@@ -1207,7 +1207,7 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda
std::ostream& operator<<(std::ostream &s, const LLWearable &w)
{
- s << "wearable " << LLWearableDictionary::getTypeName(w.mType) << "\n";
+ s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n";
s << " Name: " << w.mName << "\n";
s << " Desc: " << w.mDescription << "\n";
//w.mPermissions
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index 7bd5305079..458415228f 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -38,7 +38,7 @@
#include "llpermissions.h"
#include "llsaleinfo.h"
#include "llassetstorage.h"
-#include "llwearabledictionary.h"
+#include "llwearabletype.h"
#include "llfile.h"
#include "lllocaltextureobject.h"
@@ -68,8 +68,8 @@ public:
const LLUUID& getItemID() const;
const LLAssetID& getAssetID() const { return mAssetID; }
const LLTransactionID& getTransactionID() const { return mTransactionID; }
- EWearableType getType() const { return mType; }
- void setType(EWearableType type);
+ LLWearableType::EType getType() const { return mType; }
+ void setType(LLWearableType::EType type);
const std::string& getName() const { return mName; }
void setName(const std::string& name) { mName = name; }
const std::string& getDescription() const { return mDescription; }
@@ -93,7 +93,7 @@ public:
void writeToAvatar();
void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); }
- static void removeFromAvatar( EWearableType type, BOOL upload_bake );
+ static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake );
BOOL exportFile(LLFILE* file) const;
BOOL importFile(LLFILE* file);
@@ -156,7 +156,7 @@ private:
LLSaleInfo mSaleInfo;
LLAssetID mAssetID;
LLTransactionID mTransactionID;
- EWearableType mType;
+ LLWearableType::EType mType;
typedef std::map<S32, F32> param_map_t;
param_map_t mSavedVisualParamMap; // last saved version of visual params
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index bd5d8d9357..bac66d966a 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -103,7 +103,7 @@ LLPanelClothingListItem* LLPanelClothingListItem::create(LLViewerInventoryItem*
}
LLPanelClothingListItem::LLPanelClothingListItem(LLViewerInventoryItem* item)
- : LLPanelWearableListItem(item)
+ : LLPanelDeletableWearableListItem(item)
{
}
@@ -118,18 +118,13 @@ void LLPanelClothingListItem::init()
BOOL LLPanelClothingListItem::postBuild()
{
- LLPanelInventoryListItemBase::postBuild();
+ LLPanelDeletableWearableListItem::postBuild();
- addWidgetToLeftSide("btn_delete");
addWidgetToRightSide("btn_move_up");
addWidgetToRightSide("btn_move_down");
addWidgetToRightSide("btn_lock");
addWidgetToRightSide("btn_edit");
- LLButton* delete_btn = getChild<LLButton>("btn_delete");
- // Reserve space for 'delete' button event if it is invisible.
- setLeftWidgetsWidth(delete_btn->getRect().mRight);
-
setWidgetsVisible(false);
reshapeWidgets();
@@ -176,11 +171,51 @@ BOOL LLPanelBodyPartsListItem::postBuild()
return TRUE;
}
+
+// static
+LLPanelDeletableWearableListItem* LLPanelDeletableWearableListItem::create(LLViewerInventoryItem* item)
+{
+ LLPanelDeletableWearableListItem* list_item = NULL;
+ if(item)
+ {
+ list_item = new LLPanelDeletableWearableListItem(item);
+ list_item->init();
+ }
+ return list_item;
+}
+
+LLPanelDeletableWearableListItem::LLPanelDeletableWearableListItem(LLViewerInventoryItem* item)
+: LLPanelWearableListItem(item)
+{
+}
+
+void LLPanelDeletableWearableListItem::init()
+{
+ LLUICtrlFactory::getInstance()->buildPanel(this, "panel_deletable_wearable_list_item.xml");
+}
+
+BOOL LLPanelDeletableWearableListItem::postBuild()
+{
+ LLPanelWearableListItem::postBuild();
+
+ addWidgetToLeftSide("btn_delete");
+
+ LLButton* delete_btn = getChild<LLButton>("btn_delete");
+ // Reserve space for 'delete' button event if it is invisible.
+ setLeftWidgetsWidth(delete_btn->getRect().mRight);
+
+ setWidgetsVisible(false);
+ reshapeWidgets();
+
+ return TRUE;
+}
+
+
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
-LLPanelDummyClothingListItem* LLPanelDummyClothingListItem::create(EWearableType w_type)
+LLPanelDummyClothingListItem* LLPanelDummyClothingListItem::create(LLWearableType::EType w_type)
{
LLPanelDummyClothingListItem* list_item = new LLPanelDummyClothingListItem(w_type);
list_item->init();
@@ -201,7 +236,7 @@ BOOL LLPanelDummyClothingListItem::postBuild()
addWidgetToRightSide("btn_add");
- setIconImage(get_item_icon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, FALSE));
+ setIconImage(LLInventoryIcon::getIcon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, FALSE, mWearableType, FALSE));
updateItem();
// Make it look loke clothing item - reserve space for 'delete' button
@@ -213,7 +248,7 @@ BOOL LLPanelDummyClothingListItem::postBuild()
return TRUE;
}
-LLPanelDummyClothingListItem::LLPanelDummyClothingListItem(EWearableType w_type)
+LLPanelDummyClothingListItem::LLPanelDummyClothingListItem(LLWearableType::EType w_type)
: LLPanelWearableListItem(NULL)
, mWearableType(w_type)
{
@@ -224,26 +259,26 @@ void LLPanelDummyClothingListItem::init()
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_dummy_clothing_list_item.xml");
}
-typedef std::map<EWearableType, std::string> clothing_to_string_map_t;
+typedef std::map<LLWearableType::EType, std::string> clothing_to_string_map_t;
clothing_to_string_map_t init_clothing_string_map()
{
clothing_to_string_map_t w_map;
- w_map.insert(std::make_pair(WT_SHIRT, "shirt_not_worn"));
- w_map.insert(std::make_pair(WT_PANTS, "pants_not_worn"));
- w_map.insert(std::make_pair(WT_SHOES, "shoes_not_worn"));
- w_map.insert(std::make_pair(WT_SOCKS, "socks_not_worn"));
- w_map.insert(std::make_pair(WT_JACKET, "jacket_not_worn"));
- w_map.insert(std::make_pair(WT_GLOVES, "gloves_not_worn"));
- w_map.insert(std::make_pair(WT_UNDERSHIRT, "undershirt_not_worn"));
- w_map.insert(std::make_pair(WT_UNDERPANTS, "underpants_not_worn"));
- w_map.insert(std::make_pair(WT_SKIRT, "skirt_not_worn"));
- w_map.insert(std::make_pair(WT_ALPHA, "alpha_not_worn"));
- w_map.insert(std::make_pair(WT_TATTOO, "tattoo_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_SHIRT, "shirt_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_PANTS, "pants_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_SHOES, "shoes_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_SOCKS, "socks_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_JACKET, "jacket_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_GLOVES, "gloves_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_UNDERSHIRT, "undershirt_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_UNDERPANTS, "underpants_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_SKIRT, "skirt_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_ALPHA, "alpha_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_TATTOO, "tattoo_not_worn"));
return w_map;
}
-std::string LLPanelDummyClothingListItem::wearableTypeToString(EWearableType w_type)
+std::string LLPanelDummyClothingListItem::wearableTypeToString(LLWearableType::EType w_type)
{
static const clothing_to_string_map_t w_map = init_clothing_string_map();
static const std::string invalid_str = LLTrans::getString("invalid_not_worn");
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index 29532a15c1..5e3202c687 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -37,7 +37,7 @@
// newview
#include "llinventoryitemslist.h"
#include "llinventorymodel.h"
-#include "llwearabledictionary.h"
+#include "llwearabletype.h"
/**
* @class LLPanelWearableListItem
@@ -67,12 +67,35 @@ protected:
LLPanelWearableListItem(LLViewerInventoryItem* item);
};
+
+class LLPanelDeletableWearableListItem : public LLPanelWearableListItem
+{
+ LOG_CLASS(LLPanelDeletableWearableListItem);
+public:
+
+ static LLPanelDeletableWearableListItem* create(LLViewerInventoryItem* item);
+
+ virtual ~LLPanelDeletableWearableListItem() {};
+
+ /*virtual*/ BOOL postBuild();
+
+ /**
+ * Make button visible during mouse over event.
+ */
+ inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); }
+
+protected:
+ LLPanelDeletableWearableListItem(LLViewerInventoryItem* item);
+
+ /*virtual*/ void init();
+};
+
/**
* @class LLPanelClothingListItem
*
* Provides buttons for editing, moving, deleting a wearable.
*/
-class LLPanelClothingListItem : public LLPanelWearableListItem
+class LLPanelClothingListItem : public LLPanelDeletableWearableListItem
{
LOG_CLASS(LLPanelClothingListItem);
public:
@@ -86,7 +109,6 @@ public:
/**
* Make button visible during mouse over event.
*/
- inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); }
inline void setShowMoveUpButton(bool show) { setShowWidget("btn_move_up", show); }
inline void setShowMoveDownButton(bool show) { setShowWidget("btn_move_down", show); }
@@ -124,6 +146,7 @@ protected:
/*virtual*/ void init();
};
+
/**
* @class LLPanelDummyClothingListItem
*
@@ -132,20 +155,20 @@ protected:
class LLPanelDummyClothingListItem : public LLPanelWearableListItem
{
public:
- static LLPanelDummyClothingListItem* create(EWearableType w_type);
+ static LLPanelDummyClothingListItem* create(LLWearableType::EType w_type);
/*virtual*/ void updateItem();
/*virtual*/ BOOL postBuild();
protected:
- LLPanelDummyClothingListItem(EWearableType w_type);
+ LLPanelDummyClothingListItem(LLWearableType::EType w_type);
/*virtual*/ void init();
- static std::string wearableTypeToString(EWearableType w_type);
+ static std::string wearableTypeToString(LLWearableType::EType w_type);
private:
- EWearableType mWearableType;
+ LLWearableType::EType mWearableType;
};
/**
diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp
index 20266706da..aedaeba42a 100644
--- a/indra/newview/llwearablelist.cpp
+++ b/indra/newview/llwearablelist.cpp
@@ -121,7 +121,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
bool res = wearable->importFile( fp );
if (!res)
{
- if (wearable->getType() == WT_COUNT)
+ if (wearable->getType() == LLWearableType::WT_COUNT)
{
isNewWearable = TRUE;
}
@@ -228,14 +228,14 @@ LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std
return wearable;
}
-LLWearable* LLWearableList::createNewWearable( EWearableType type )
+LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
{
lldebugs << "LLWearableList::createNewWearable()" << llendl;
LLWearable *wearable = generateNewWearable();
wearable->setType( type );
- std::string name = LLTrans::getString( LLWearableDictionary::getTypeDefaultNewName(wearable->getType()) );
+ std::string name = LLTrans::getString( LLWearableType::getTypeDefaultNewName(wearable->getType()) );
wearable->setName( name );
LLPermissions perm;
diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h
index 5e564ba953..16ef11b8bd 100644
--- a/indra/newview/llwearablelist.h
+++ b/indra/newview/llwearablelist.h
@@ -61,7 +61,7 @@ public:
void* userdata);
LLWearable* createCopy(const LLWearable* old_wearable, const std::string& new_name = std::string());
- LLWearable* createNewWearable(EWearableType type);
+ LLWearable* createNewWearable(LLWearableType::EType type);
// Callback
static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status);
diff --git a/indra/newview/llwearabletype.cpp b/indra/newview/llwearabletype.cpp
new file mode 100644
index 0000000000..c692df06ad
--- /dev/null
+++ b/indra/newview/llwearabletype.cpp
@@ -0,0 +1,138 @@
+/**
+ * @file llwearabletype.cpp
+ * @brief LLWearableType class implementation
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ *
+ * Copyright (c) 2002-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llwearabletype.h"
+#include "llinventoryfunctions.h"
+#include "lltrans.h"
+
+struct WearableEntry : public LLDictionaryEntry
+{
+ WearableEntry(const std::string &name,
+ const std::string& default_new_name,
+ LLAssetType::EType assetType,
+ LLInventoryIcon::EIconName iconName);
+ const LLAssetType::EType mAssetType;
+ const std::string mLabel;
+ const std::string mDefaultNewName; //keep mLabel for backward compatibility
+ LLInventoryIcon::EIconName mIconName;
+};
+
+WearableEntry::WearableEntry(const std::string &name,
+ const std::string& default_new_name,
+ LLAssetType::EType assetType,
+ LLInventoryIcon::EIconName iconName) :
+ LLDictionaryEntry(name),
+ mAssetType(assetType),
+ mDefaultNewName(default_new_name),
+ mLabel(LLTrans::getString(name)),
+ mIconName(iconName)
+{
+}
+
+class LLWearableDictionary : public LLSingleton<LLWearableDictionary>,
+ public LLDictionary<LLWearableType::EType, WearableEntry>
+{
+public:
+ LLWearableDictionary();
+};
+
+LLWearableDictionary::LLWearableDictionary()
+{
+ addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SHAPE));
+ addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SKIN));
+ addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_HAIR));
+ addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_EYES));
+ addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHIRT));
+ addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_PANTS));
+ addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHOES));
+ addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SOCKS));
+ addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_JACKET));
+ addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_GLOVES));
+ addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERSHIRT));
+ addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERPANTS));
+ addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SKIRT));
+ addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_ALPHA));
+ addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_TATTOO));
+ addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE));
+ addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE));
+ addEntry(LLWearableType::WT_COUNT, NULL);
+}
+
+// static
+LLWearableType::EType LLWearableType::typeNameToType(const std::string& type_name)
+{
+ const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
+ const LLWearableType::EType wearable = dict->lookup(type_name);
+ return wearable;
+}
+
+// static
+const std::string& LLWearableType::getTypeName(LLWearableType::EType type)
+{
+ const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
+ const WearableEntry *entry = dict->lookup(type);
+ return entry->mName;
+}
+
+//static
+const std::string& LLWearableType::getTypeDefaultNewName(LLWearableType::EType type)
+{
+ const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
+ const WearableEntry *entry = dict->lookup(type);
+ return entry->mDefaultNewName;
+}
+
+// static
+const std::string& LLWearableType::getTypeLabel(LLWearableType::EType type)
+{
+ const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
+ const WearableEntry *entry = dict->lookup(type);
+ return entry->mLabel;
+}
+
+// static
+LLAssetType::EType LLWearableType::getAssetType(LLWearableType::EType type)
+{
+ const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
+ const WearableEntry *entry = dict->lookup(type);
+ return entry->mAssetType;
+}
+
+// static
+LLInventoryIcon::EIconName LLWearableType::getIconName(LLWearableType::EType type)
+{
+ const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
+ const WearableEntry *entry = dict->lookup(type);
+ return entry->mIconName;
+}
+
diff --git a/indra/newview/llwearabletype.h b/indra/newview/llwearabletype.h
new file mode 100644
index 0000000000..8090fd8df7
--- /dev/null
+++ b/indra/newview/llwearabletype.h
@@ -0,0 +1,78 @@
+/**
+ * @file llwearabletype.h
+ * @brief LLWearableType class header file
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ *
+ * Copyright (c) 2002-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLWEARABLETYPE_H
+#define LL_LLWEARABLETYPE_H
+
+#include "llassettype.h"
+#include "lldictionary.h"
+#include "llinventoryicon.h"
+#include "llsingleton.h"
+
+class LLWearableType
+{
+public:
+ enum EType
+ {
+ WT_SHAPE = 0,
+ WT_SKIN = 1,
+ WT_HAIR = 2,
+ WT_EYES = 3,
+ WT_SHIRT = 4,
+ WT_PANTS = 5,
+ WT_SHOES = 6,
+ WT_SOCKS = 7,
+ WT_JACKET = 8,
+ WT_GLOVES = 9,
+ WT_UNDERSHIRT = 10,
+ WT_UNDERPANTS = 11,
+ WT_SKIRT = 12,
+ WT_ALPHA = 13,
+ WT_TATTOO = 14,
+ WT_COUNT = 15,
+
+ WT_INVALID = 255,
+ WT_NONE = -1,
+ };
+
+ static const std::string& getTypeName(EType type);
+ static const std::string& getTypeDefaultNewName(EType type);
+ static const std::string& getTypeLabel(EType type);
+ static LLAssetType::EType getAssetType(EType type);
+ static EType typeNameToType(const std::string& type_name);
+ static LLInventoryIcon::EIconName getIconName(EType type);
+
+protected:
+ LLWearableType() {}
+ ~LLWearableType() {}
+};
+
+#endif // LL_LLWEARABLETYPE_H
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 1a64f9d881..aa03b1afd1 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -155,7 +155,7 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
substitution["VERSION_PATCH"] = LLVersionInfo::getPatch();
substitution["VERSION_BUILD"] = LLVersionInfo::getBuild();
substitution["CHANNEL"] = LLVersionInfo::getChannel();
- substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel();
+ substitution["GRID"] = LLGridManager::getInstance()->getGridLabel();
substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
substitution["SESSION_ID"] = gAgent.getSessionID();
substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 0b63f5efbd..58b9f5ce18 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -133,10 +133,11 @@ void LLWorld::destroyClass()
LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
{
LLMemType mt(LLMemType::MTYPE_REGIONS);
-
+ llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl;
LLViewerRegion *regionp = getRegionFromHandle(region_handle);
if (regionp)
{
+ llinfos << "Region exists, removing it " << llendl;
LLHost old_host = regionp->getHost();
// region already exists!
if (host == old_host && regionp->isAlive())
diff --git a/indra/newview/llworldmipmap.cpp b/indra/newview/llworldmipmap.cpp
index 1cdccd2baa..debd6b611f 100644
--- a/indra/newview/llworldmipmap.cpp
+++ b/indra/newview/llworldmipmap.cpp
@@ -33,6 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llworldmipmap.h"
+#include "llviewercontrol.h" // LLControlGroup
#include "llviewertexturelist.h"
#include "math.h" // log()
@@ -186,8 +187,8 @@ LLPointer<LLViewerFetchedTexture> LLWorldMipmap::getObjectsTile(U32 grid_x, U32
LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 grid_y, S32 level)
{
// Get the grid coordinates
- std::string imageurl = llformat("http://map.secondlife.com.s3.amazonaws.com/map-%d-%d-%d-objects.jpg",
- level, grid_x, grid_y);
+ std::string imageurl = gSavedSettings.getString("MapServerURL") + llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y);
+
// DO NOT COMMIT!! DEBUG ONLY!!!
// Use a local jpeg for every tile to test map speed without S3 access
diff --git a/indra/newview/llworldview.cpp b/indra/newview/llworldview.cpp
new file mode 100644
index 0000000000..665cc74a87
--- /dev/null
+++ b/indra/newview/llworldview.cpp
@@ -0,0 +1,61 @@
+/**
+ * @file llworldview.cpp
+ * @brief LLWorldView class implementation
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llworldview.h"
+
+#include "llviewercontrol.h"
+#include "llsidetray.h"
+/////////////////////////////////////////////////////
+// LLFloaterView
+
+static LLDefaultChildRegistry::Register<LLWorldView> r("world_view");
+
+LLWorldView::LLWorldView(const Params& p)
+: LLUICtrl (p)
+{
+}
+
+void LLWorldView::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+ if (FALSE == gSavedSettings.getBOOL("SidebarCameraMovement") )
+ {
+ LLView* main_view = LLUI::getRootView()->findChild<LLView>("main_view");
+ if(main_view)
+ {
+ width = main_view->getRect().getWidth();
+ }
+ }
+
+ LLUICtrl::reshape(width, height, called_from_parent);
+}
diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp
index 15417614af..8237132ac5 100644
--- a/indra/newview/llxmlrpclistener.cpp
+++ b/indra/newview/llxmlrpclistener.cpp
@@ -28,6 +28,7 @@
#include "llerror.h"
#include "stringize.h"
#include "llxmlrpctransaction.h"
+#include "llsecapi.h"
#if LL_WINDOWS
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
@@ -356,7 +357,22 @@ public:
<< data["errorcode"].asString()
<< " (" << data["error"].asString() << ")"
<< LL_ENDL;
- // In addition to CURLE_OK, LLUserAuth distinguishes different error
+
+ switch (curlcode)
+ {
+ case CURLE_SSL_PEER_CERTIFICATE:
+ case CURLE_SSL_CACERT:
+ {
+ LLPointer<LLCertificate> error_cert(mTransaction->getErrorCert());
+ if(error_cert)
+ {
+ data["certificate"] = error_cert->getPem();
+ }
+ break;
+ }
+ default:
+ break;
+ }
// values of 'curlcode':
// CURLE_COULDNT_RESOLVE_HOST,
// CURLE_SSL_PEER_CERTIFICATE,
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index 5884cdd1c3..da61840761 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -31,6 +31,9 @@
*/
#include "llviewerprecompiledheaders.h"
+#include <openssl/x509_vfy.h>
+#include <openssl/ssl.h>
+#include "llsecapi.h"
#include "llxmlrpctransaction.h"
#include "llxmlrpclistener.h"
@@ -176,6 +179,8 @@ public:
std::string mResponseText;
XMLRPC_REQUEST mResponse;
+ std::string mCertStore;
+ LLPointer<LLCertificate> mErrorCert;
Impl(const std::string& uri, XMLRPC_REQUEST request, bool useGzip);
Impl(const std::string& uri,
@@ -190,7 +195,8 @@ public:
private:
void init(XMLRPC_REQUEST request, bool useGzip);
-
+ static int _sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param);
+ static CURLcode _sslCtxFunction(CURL * curl, void *sslctx, void *param);
static size_t curlDownloadCallback(
char* data, size_t size, size_t nmemb, void* user_data);
};
@@ -228,8 +234,74 @@ LLXMLRPCTransaction::Impl::Impl(const std::string& uri,
XMLRPC_RequestFree(request, 1);
}
+// _sslCertVerifyCallback
+// callback called when a cert verification is requested.
+// calls SECAPI to validate the context
+int LLXMLRPCTransaction::Impl::_sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
+{
+ LLXMLRPCTransaction::Impl *transaction = (LLXMLRPCTransaction::Impl *)param;
+ LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(transaction->mCertStore);
+ LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx);
+ LLSD validation_params = LLSD::emptyMap();
+ LLURI uri(transaction->mURI);
+ validation_params[CERT_HOSTNAME] = uri.hostName();
+ try
+ {
+ chain->validate(VALIDATION_POLICY_SSL, store, validation_params);
+ }
+ catch (LLCertValidationTrustException& cert_exception)
+ {
+ // this exception is is handled differently than the general cert
+ // exceptions, as we allow the user to actually add the certificate
+ // for trust.
+ // therefore we pass back a different error code
+ // NOTE: We're currently 'wired' to pass around CURL error codes. This is
+ // somewhat clumsy, as we may run into errors that do not map directly to curl
+ // error codes. Should be refactored with login refactoring, perhaps.
+ transaction->mCurlCode = CURLE_SSL_CACERT;
+ // set the status directly. set curl status generates error messages and we want
+ // to use the fixed ones from the exceptions
+ transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
+ // We should probably have a more generic way of passing information
+ // back to the error handlers.
+ transaction->mErrorCert = cert_exception.getCert();
+ return 0;
+ }
+ catch (LLCertException& cert_exception)
+ {
+ transaction->mCurlCode = CURLE_SSL_PEER_CERTIFICATE;
+ // set the status directly. set curl status generates error messages and we want
+ // to use the fixed ones from the exceptions
+ transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
+ transaction->mErrorCert = cert_exception.getCert();
+ return 0;
+ }
+ catch (...)
+ {
+ // any other odd error, we just handle as a connect error.
+ transaction->mCurlCode = CURLE_SSL_CONNECT_ERROR;
+ transaction->setCurlStatus(CURLE_SSL_CONNECT_ERROR);
+ return 0;
+ }
+ return 1;
+}
+// _sslCtxFunction
+// Callback function called when an SSL Context is created via CURL
+// used to configure the context for custom cert validate(<, <#const & xs#>, <#T * #>, <#long #>)tion
+// based on SECAPI
+CURLcode LLXMLRPCTransaction::Impl::_sslCtxFunction(CURL * curl, void *sslctx, void *param)
+{
+ SSL_CTX * ctx = (SSL_CTX *) sslctx;
+ // disable any default verification for server certs
+ SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
+ // set the verification callback.
+ SSL_CTX_set_cert_verify_callback(ctx, _sslCertVerifyCallback, param);
+ // the calls are void
+ return CURLE_OK;
+
+}
void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
{
@@ -237,6 +309,7 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
{
mCurlRequest = new LLCurlEasyRequest();
}
+ mErrorCert = NULL;
if (gSavedSettings.getBOOL("BrowserProxyEnabled"))
{
@@ -252,12 +325,13 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
// mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
mCurlRequest->setWriteCallback(&curlDownloadCallback, (void*)this);
- BOOL verifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
- mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify() ? 2 : 0);
- mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, verifySSLCert);
- mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, verifySSLCert ? 2 : 0);
+ BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
+ mCertStore = gSavedSettings.getString("CertStore");
+ mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, vefifySSLCert);
+ mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, vefifySSLCert ? 2 : 0);
// Be a little impatient about establishing connections.
mCurlRequest->setopt(CURLOPT_CONNECTTIMEOUT, 40L);
+ mCurlRequest->setSSLCtxCallback(_sslCtxFunction, (void *)this);
/* Setting the DNS cache timeout to -1 disables it completely.
This might help with bug #503 */
@@ -343,11 +417,19 @@ bool LLXMLRPCTransaction::Impl::process()
{
if (result != CURLE_OK)
{
- setCurlStatus(result);
- llwarns << "LLXMLRPCTransaction CURL error "
- << mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
- llwarns << "LLXMLRPCTransaction request URI: "
- << mURI << llendl;
+ if ((result != CURLE_SSL_PEER_CERTIFICATE) &&
+ (result != CURLE_SSL_CACERT))
+ {
+ // if we have a curl error that's not already been handled
+ // (a non cert error), then generate the error message as
+ // appropriate
+ setCurlStatus(result);
+
+ llwarns << "LLXMLRPCTransaction CURL error "
+ << mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
+ llwarns << "LLXMLRPCTransaction request URI: "
+ << mURI << llendl;
+ }
return true;
}
@@ -425,7 +507,6 @@ void LLXMLRPCTransaction::Impl::setStatus(EStatus status,
case StatusComplete:
mStatusMessage = "(done)";
break;
-
default:
// Usually this means that there's a problem with the login server,
// not with the client. Direct user to status page.
@@ -541,6 +622,11 @@ std::string LLXMLRPCTransaction::statusMessage()
return impl.mStatusMessage;
}
+LLPointer<LLCertificate> LLXMLRPCTransaction::getErrorCert()
+{
+ return impl.mErrorCert;
+}
+
std::string LLXMLRPCTransaction::statusURI()
{
return impl.mStatusURI;
diff --git a/indra/newview/llxmlrpctransaction.h b/indra/newview/llxmlrpctransaction.h
index c835423d67..8beb2e2623 100644
--- a/indra/newview/llxmlrpctransaction.h
+++ b/indra/newview/llxmlrpctransaction.h
@@ -38,6 +38,7 @@
typedef struct _xmlrpc_request* XMLRPC_REQUEST;
typedef struct _xmlrpc_value* XMLRPC_VALUE;
// foward decl of types from xmlrpc.h (this usage is type safe)
+class LLCertificate;
class LLXMLRPCValue
// a c++ wrapper around XMLRPC_VALUE
@@ -115,6 +116,8 @@ public:
EStatus status(int* curlCode);
// return status, and extended CURL code, if code isn't null
+
+ LLPointer<LLCertificate> getErrorCert();
std::string statusMessage();
// return a message string, suitable for showing the user
std::string statusURI();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 2d2fc38573..cc65b34a61 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -284,6 +284,7 @@ BOOL LLPipeline::sRenderFrameTest = FALSE;
BOOL LLPipeline::sRenderAttachedLights = TRUE;
BOOL LLPipeline::sRenderAttachedParticles = TRUE;
BOOL LLPipeline::sRenderDeferred = FALSE;
+BOOL LLPipeline::sAllowRebuildPriorityGroup = FALSE ;
S32 LLPipeline::sVisibleLightCount = 0;
F32 LLPipeline::sMinRenderSize = 0.f;
@@ -1780,6 +1781,12 @@ void LLPipeline::updateGL()
void LLPipeline::rebuildPriorityGroups()
{
+ if(!sAllowRebuildPriorityGroup)
+ {
+ return ;
+ }
+ sAllowRebuildPriorityGroup = FALSE ;
+
LLTimer update_timer;
LLMemType mt(LLMemType::MTYPE_PIPELINE);
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 60e0b0ae8c..89649a0682 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -462,6 +462,7 @@ public:
static BOOL sRenderAttachedLights;
static BOOL sRenderAttachedParticles;
static BOOL sRenderDeferred;
+ static BOOL sAllowRebuildPriorityGroup;
static S32 sVisibleLightCount;
static F32 sMinRenderSize;
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 99603530d8..0540a03e25 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -424,6 +424,9 @@
name="InventoryItemLibraryColor"
reference="EmphasisColor" />
<color
+ name="InventoryItemLinkColor"
+ reference="LtGray_50" />
+ <color
name="InventorySearchStatusColor"
reference="EmphasisColor" />
<color
diff --git a/indra/newview/skins/default/textures/bottomtray/Movement_Left_Off.png b/indra/newview/skins/default/textures/bottomtray/Movement_Left_Off.png
new file mode 100644
index 0000000000..ded370a46f
--- /dev/null
+++ b/indra/newview/skins/default/textures/bottomtray/Movement_Left_Off.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/bottomtray/Movement_Left_On.png b/indra/newview/skins/default/textures/bottomtray/Movement_Left_On.png
new file mode 100644
index 0000000000..98bf415f84
--- /dev/null
+++ b/indra/newview/skins/default/textures/bottomtray/Movement_Left_On.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/bottomtray/Movement_Right_Off.png b/indra/newview/skins/default/textures/bottomtray/Movement_Right_Off.png
new file mode 100644
index 0000000000..2d8d55fa91
--- /dev/null
+++ b/indra/newview/skins/default/textures/bottomtray/Movement_Right_Off.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/bottomtray/Movement_Right_On.png b/indra/newview/skins/default/textures/bottomtray/Movement_Right_On.png
new file mode 100644
index 0000000000..a91517d31f
--- /dev/null
+++ b/indra/newview/skins/default/textures/bottomtray/Movement_Right_On.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/icons/Female.png b/indra/newview/skins/default/textures/icons/Female.png
new file mode 100644
index 0000000000..67b5653a94
--- /dev/null
+++ b/indra/newview/skins/default/textures/icons/Female.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png
new file mode 100644
index 0000000000..c067646c65
--- /dev/null
+++ b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/icons/Male.png b/indra/newview/skins/default/textures/icons/Male.png
new file mode 100644
index 0000000000..f3fad77fd0
--- /dev/null
+++ b/indra/newview/skins/default/textures/icons/Male.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index bbb82d86b1..f4206dc2e5 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -135,6 +135,7 @@ with the same filename but different name
<texture name="ForwardArrow_Press" file_name="icons/ForwardArrow_Press.png" preload="false" />
<texture name="Generic_Group" file_name="icons/Generic_Group.png" preload="false" />
+ <texture name="Generic_Group_Large" file_name="icons/Generic_Group_Large.png" preload="false" />
<texture name="icon_group.tga" file_name="icons/Generic_Group.png" preload="false" />
<texture name="Generic_Object_Small" file_name="icons/Generic_Object_Small.png" preload="false" />
<texture name="Generic_Person" file_name="icons/Generic_Person.png" preload="false" />
@@ -214,6 +215,40 @@ with the same filename but different name
<texture name="Inv_Underpants" file_name="icons/Inv_Underpants.png" preload="false" />
<texture name="Inv_Undershirt" file_name="icons/Inv_Undershirt.png" preload="false" />
+ <texture name="Inv_Alpha_Link" file_name="icons/Inv_Alpha_Link.png" preload="false" />
+ <texture name="Inv_Animation_Link" file_name="icons/Inv_Animation_Link.png" preload="false" />
+ <texture name="Inv_BodyShape_Link" file_name="icons/Inv_BodyShape_Link.png" preload="false" />
+ <texture name="Inv_CallingCard_Link" file_name="icons/Inv_CallingCard_Link.png" preload="false" />
+ <texture name="Inv_Clothing_Link" file_name="icons/Inv_Clothing_Link.png" preload="false" />
+ <texture name="Inv_Eye_Link" file_name="icons/Inv_Eye_Link.png" preload="false" />
+ <texture name="Inv_FolderClosed_Link" file_name="icons/Inv_FolderClosed_Link.png" preload="false" />
+ <texture name="Inv_FolderOpen_Link" file_name="icons/Inv_FolderOpen_Link.png" preload="false" />
+ <texture name="Inv_Gesture_Link" file_name="icons/Inv_Gesture_Link.png" preload="false" />
+ <texture name="Inv_Gloves_Link" file_name="icons/Inv_Gloves_Link.png" preload="false" />
+ <texture name="Inv_Hair_Link" file_name="icons/Inv_Hair_Link.png" preload="false" />
+ <texture name="Inv_LinkItem_Link" file_name="icons/Inv_LinkItem_Link.png" preload="false" />
+ <texture name="Inv_LinkFolder_Link" file_name="icons/Inv_LinkFolder_Link.png" preload="false" />
+ <texture name="Inv_Jacket_Link" file_name="icons/Inv_Jacket_Link.png" preload="false" />
+ <texture name="Inv_LookFolderOpen_Link" file_name="icons/Inv_LookFolderOpen_Link.png" preload="false" />
+ <texture name="Inv_LookFolderClosed_Link" file_name="icons/Inv_LookFolderClosed_Link.png" preload="false" />
+ <texture name="Inv_Landmark_Link" file_name="icons/Inv_Landmark_Link.png" preload="false" />
+ <texture name="Inv_Notecard_Link" file_name="icons/Inv_Notecard_Link.png" preload="false" />
+ <texture name="Inv_Object_Link" file_name="icons/Inv_Object_Link.png" preload="false" />
+ <texture name="Inv_Object_Multi_Link" file_name="icons/Inv_Object_Multi_Link.png" preload="false" />
+ <texture name="Inv_Pants_Link" file_name="icons/Inv_Pants_Link.png" preload="false" />
+ <texture name="Inv_Script_Link" file_name="icons/Inv_Script_Link.png" preload="false" />
+ <texture name="Inv_Shirt_Link" file_name="icons/Inv_Shirt_Link.png" preload="false" />
+ <texture name="Inv_Shoe_Link" file_name="icons/Inv_Shoe_Link.png" preload="false" />
+ <texture name="Inv_Skin_Link" file_name="icons/Inv_Skin_Link.png" preload="false" />
+ <texture name="Inv_Skirt_Link" file_name="icons/Inv_Skirt_Link.png" preload="false" />
+ <texture name="Inv_Snapshot_Link" file_name="icons/Inv_Snapshot_Link.png" preload="false" />
+ <texture name="Inv_Socks_Link" file_name="icons/Inv_Socks_Link.png" preload="false" />
+ <texture name="Inv_Sound_Link" file_name="icons/Inv_Sound_Link.png" preload="false" />
+ <texture name="Inv_Tattoo_Link" file_name="icons/Inv_Tattoo_Link.png" preload="false" />
+ <texture name="Inv_Texture_Link" file_name="icons/Inv_Texture_Link.png" preload="false" />
+ <texture name="Inv_Underpants_Link" file_name="icons/Inv_Underpants_Link.png" preload="false" />
+ <texture name="Inv_Undershirt_Link" file_name="icons/Inv_Undershirt_Link.png" preload="false" />
+
<texture name="Linden_Dollar_Alert" file_name="widgets/Linden_Dollar_Alert.png"/>
<texture name="Linden_Dollar_Background" file_name="widgets/Linden_Dollar_Background.png"/>
@@ -241,6 +276,10 @@ with the same filename but different name
<texture name="Movement_Down_On" file_name="bottomtray/Movement_Down_On.png" preload="false" />
<texture name="Movement_Forward_Off" file_name="bottomtray/Movement_Forward_Off.png" preload="false" />
<texture name="Movement_Forward_On" file_name="bottomtray/Movement_Forward_On.png" preload="false" />
+ <texture name="Movement_Left_Off" file_name="bottomtray/Movement_Left_Off.png" preload="false" />
+ <texture name="Movement_Left_On" file_name="bottomtray/Movement_Left_On.png" preload="false" />
+ <texture name="Movement_Right_Off" file_name="bottomtray/Movement_Right_Off.png" preload="false" />
+ <texture name="Movement_Right_On" file_name="bottomtray/Movement_Right_On.png" preload="false" />
<texture name="Movement_TurnLeft_Off" file_name="bottomtray/Movement_TurnLeft_Off.png" preload="false" />
<texture name="Movement_TurnLeft_On" file_name="bottomtray/Movement_TurnLeft_On.png" preload="false" />
<texture name="Movement_TurnRight_Off" file_name="bottomtray/Movement_TurnRight_Off.png" preload="false" />
diff --git a/indra/newview/skins/default/xui/da/floater_about.xml b/indra/newview/skins/default/xui/da/floater_about.xml
index 91db3c6b1c..435c7f4907 100644
--- a/indra/newview/skins/default/xui/da/floater_about.xml
+++ b/indra/newview/skins/default/xui/da/floater_about.xml
@@ -43,9 +43,14 @@ Vivox Version: [VIVOX_VERSION]
</panel>
<panel label="Tak til" name="credits_panel">
<text_editor name="credits_editor">
- Second Life er gjort muligt for dig af Philip, Tessa, Andrew, Cory, James, Ben, Char, Charlie, Colin, Dan, Daniel, Doug, Eric, Hamlet, Haney, Eve, Hunter, Ian, Jeff, Jennifer, Jim, John, Lee, Mark, Peter, Phoenix, Richard, Robin, Xenon, Steve, Tanya, Eddie, Avi, Frank, Bruce, Aaron, Alice, Bob, Debra, Eileen, Helen, Janet, Louie, Leviathania, Stefan, Ray, Kevin, Tom, Mikeb, MikeT, Burgess, Elena, Tracy, Bill, Todd, Ryan, Zach, Sarah, Nova, Tim, Stephanie, Michael, Evan, Nicolas, Catherine, Rachelle, Dave, Holly, Bub, Kelly, Magellan, Ramzi, Don, Sabin, Jill, Rheya, Jeska, Torley, Kona, Callum, Charity, Ventrella, Jack, Vektor, Iris, Chris, Nicole, Mick, Reuben, Blue, Babbage, Yedwab, Deana, Lauren, Brent, Pathfinder, Chadrick, Altruima, Jesse, Teeny, Monroe, Icculus, David, Tess, Lizzie, Patsy, Isaac, Lawrence, Cyn, Bo, Gia, Annette, Marius, Tbone, Jonathan, Karen, Ginsu, Satoko, Yuko, Makiko, Thomas, Harry, Seth, Alexei, Brian, Guy, Runitai, Ethan, Data, Cornelius, Kenny, Swiss, Zero, Natria, Wendy, Stephen, Teeple, Thumper, Lucy, Dee, Mia, Liana, Warren, Branka, Aura, beez, Milo, Hermia, Red, Thrax, Joe, Sally, Magenta, Mogura, Paul, Jose, Rejean, Henrik, Lexie, Amber, Logan, Xan, Nora, Morpheus, Donovan, Leyla, MichaelFrancis, Beast, Cube, Bucky, Joshua, Stryfe, Harmony, Teresa, Claudia, Walker, Glenn, Fritz, Fordak, June, Cleopetra, Jean, Ivy, Betsy, Roosevelt, Spike, Ken, Which, Tofu, Chiyo, Rob, Zee, dustin, George, Del, Matthew, Cat, Jacqui, Lightfoot, Adrian, Viola, Alfred, Noel, Irfan, Sunil, Yool, Rika, Jane, Xtreme, Frontier, a2, Neo, Siobhan, Yoz, Justin, Elle, Qarl, Benjamin, Isabel, Gulliver, Everett, Christopher, Izzy, Stephany, Garry, Sejong, Sean, Tobin, Iridium, Meta, Anthony, Jeremy, JP, Jake, Maurice, Madhavi, Leopard, Kyle, Joon, Kari, Bert, Belinda, Jon, Kristi, Bridie, Pramod, KJ, Socrates, Maria, Ivan, Aric, Yamasaki, Adreanne, Jay, MitchK, Ceren, Coco, Durl, Jenny, Periapse, Kartic, Storrs, Lotte, Sandy, Rohn, Colossus, Zen, BigPapi, Brad, Pastrami, Kurz, Mani, Neuro, Jaime, MJ, Rowan, Sgt, Elvis, Gecko, Samuel, Sardonyx, Leo, Bryan, Niko, Soft, Poppy, Rachel, Aki, Angelo, Banzai, Alexa, Sue, CeeLo, Bender, CG, Gillian, Pelle, Nick, Echo, Zara, Christine, Shamiran, Emma, Blake, Keiko, Plexus, Joppa, Sidewinder, Erica, Ashlei, Twilight, Kristen, Brett, Q, Enus, Simon, Bevis, Kraft, Kip, Chandler, Ron, LauraP, Ram, KyleJM, Scouse, Prospero, Melissa, Marty, Nat, Hamilton, Kend, Lordan, Jimmy, Kosmo, Seraph, Green, Ekim, Wiggo, JT, Rome, Doris, Miz, Benoc, Whump, Trinity, Patch, Kate, TJ, Bao, Joohwan, Christy, Sofia, Matias, Cogsworth, Johan, Oreh, Cheah, Angela, Brandy, Mango, Lan, Aleks, Gloria, Heidy, Mitchell, Space, Colton, Bambers, Einstein, Maggie, Malbers, Rose, Winnie, Stella, Milton, Rothman, Niall, Marin, Allison, Katie, Dawn, Katt, Dusty, Kalpana, Judy, Andrea, Ambroff, Infinity, Gail, Rico, Raymond, Yi, William, Christa, M, Teagan, Scout, Molly, Dante, Corr, Dynamike, Usi, Kaylee, Vidtuts, Lil, Danica, Sascha, Kelv, Jacob, Nya, Rodney, Brandon, Elsie, Blondin, Grant, Katrin, Nyx, Gabriel, Locklainn, Claire, Devin, Minerva, Monty, Austin, Bradford, Si, Keira, H, Caitlin, Dita, Makai, Jenn, Ann, Meredith, Clare, Joy, Praveen, Cody, Edmund, Ruthe, Sirena, Gayathri, Spider, FJ, Davidoff, Tian, Jennie, Louise, Oskar, Landon, Noelle, Jarv, Ingrid, Al, Sommer, Doc, Aria, Huin, Gray, Lili, Vir, DJ, Yang, T, Simone, Maestro, Scott, Charlene, Quixote, Amanda, Susan, Zed, Anne, Enkidu, Esbee, Joroan, Katelin, Roxie, Tay, Scarlet, Kevin, Johnny, Wolfgang, Andren, Bob, Howard, Merov, Rand, Ray, Michon, Newell, Galen, Dessie, Les og mange flere.
+ Second Life er lavet til dig af Philip, Tessa, Andrew, Cory, Ian, James, Phoenix, Ryan, Haney, Dan, Char, Ben, John, Tanya, Eddie, Richard, Mitch, Doug, Eric, Frank, Bruce, Aaron, Peter, Alice, Charlie, Debra, Eileen, Helen, Janet, Steffan, Steve, Tom, Mark, Hunter, Xenon, Burgess, Bill, Jim, Lee, Hamlet, Daniel, Jeff, Todd, Sarah, Tim, Stephanie, Colin, Michael, Evan, Nicolas, Catherine, Rachelle, Dave, Holly, Bub, Kelly, Ramzi, Don, Sabin, Jill, Rheya, Jeska, Torley, Kona, Callum, Charity, Jack, Vektor, Chris, Nicole, Mick, Reuben, Blue, Babbage, Yedwab, Deana, Lauren, Brent, Pathfinder, Chadrick, Jesse, David, Tess, Lizzie, Patsy, Isaac, Lawrence, Cyn, Bo, Gia, Annette, Marius, Tbone, Jonathan, Karen, Ginsu, Yuko, Makiko, Thomas, Harry, Seth, Brian, Guy, Runitai, Ethan, Data, Cornelius, Kenny, Swiss, Zero, Brad, Natria, Wendy, Stephen, Teeple, Thumper, Lucy, Dee, Mia, Liana, Warren, Branka, Aura, Beez, Milo, Hermia, Red, Thrax, Gulliver, Joe, Sally, Paul, Jose, Rejean, Dore, Henrik, Lexie, Amber, Logan, Xan, Nora, Morpheus, Donovan, Leyla, MichaelFrancis, Beast, Cube, Bucky, Joshua, Stryfe, Harmony, Teresa, Claudia, Walker, Glenn, Fritz, Fordak, June, Cleopetra, Ivy, Betsy, Roosevelt, Spike, Ken, Which, Tofu, Chiyo, Rob, Zee, Dustin, George, Del, Matthew, Cat, Jacqui, Adrian, Viola, Alfred, Noel, Irfan, Yool, Rika, Jane, Frontier, Neo, Siobhan, Yoz, Justin, Elle, Qarl, Benjamin, Isabel, Everett, Christopher, Izzy, Stephany, Garry, Sejong, Sean, Tobin, Iridium, Meta, Jeremy, JP, Jake, Anthony, Maurice, Madhavi, Leopard, Kyle, Joon, Bert, Belinda, Jon, Kristi, Bridie, Pramod, Socrates, Maria, Aric, Adreanne, Jay, Kari, Ceren, Coco, Durl, Jenny, Periapse, Kartic, Storrs, Lotte, Sandy, Colossus, Zen, BigPapi, Pastrami, Kurz, Mani, Neuro, Mel, Sardonyx, MJ, Rowan, Sgt, Elvis, Samuel, Leo, Bryan, Niko, Austin, Soft, Poppy, Rachel, Aki, Banzai, Alexa, Sue, Bender, CG, Angelo, Gillian, Pelle, Nick, Echo, Zara, Christine, Shamiran, Emma, Blake, Keiko, Plexus, Joppa, Sidewinder, Erica, Ashlei, Twilight, Kristen, Brett, Q, Enus, Simon, Bevis, Kraft, Kip, Chandler, Ron, LauraP, Ram, KyleJM, Scouse, Prospero, Melissa, Marty, Nat, Hamilton, Kend, Lordan, Jimmy, Kosmo, Seraph, Green, Ekim, Wiggo, JT, Rome, Doris, Miz, Benoc, Whump, Trinity, Patch, Kate, TJ, Bao, Joohwan, Christy, Sofia, Matias, Cogsworth, Johan, Oreh, Cheah, Angela, Brandy, Mango, Lan, Aleks, Gloria, Mitchell, Space, Colton, Bambers, Einstein, Maggie, Malbers, Rose, Rothman, Niall, Marin, Allison, Katie, Dawn, Dusty, Katt, Judy, Andrea, Ambroff, Infinity, Rico, Gail, Kalpana, Raymond, Yi, William, Christa, M, Teagan, Scout, Molly, Dante, Corr, Dynamike, Usi, Kaylee, Lil, Danica, Sascha, Kelv, Jacob, Nya, Rodney, Brandon, Elsie, Blondin, Grant, Katrin, Nyx, Gabriel, Locklainn, Claire, Devin, Minerva, Monty, Bradford, Si, Keira, H, Caitlin, Dita, Makai, Jenn, Ann, Meredith, Clare, Joy, Praveen, Cody, Edmund, Ruthe, Sirena, Gayathri, Spider, FJ, Davidoff, Tian, Jennie, Louise, Oskar, Landon, Noelle, Jarv, Ingrid, Al, Sommer, Doc, Aria, Huin, Gray, Lili, Vir, DJ, Maestro, Simone, Yang, T, Shannon, Nelson, Khanh, Scott, Courtney, Charlene, Quixote, Susan, Zed, Amanda, Katelin, Enkidu, Roxie, Esbee, JoRoan, Scarlet, Tay, Kevin, Wolfgang, Johnny, Ray, Andren, Merov, Bob, Rand, Howard, Callen, Heff, Galen, Newell, Dessie, Les, Michon, Jenelle, Geo, Siz, Shapiro, Pete, Calyle, Selene, Allen, Phoebe, Goldin, Kimmora, Dakota, Slaton, Lindquist, Zoey, Hari, Othello, Rohit, Sheldon, Petra, Viale, Gordon, Kaye, Pink, Ferny, Emerson, Davy, Bri, Chan, Juan, Robert, Terrence, Nathan, Carl, Ashley, JessieAnn, Huseby, Karina, Paris, Kurt, Rick, Lis, Kotler, Theeba, Lynx, Murphy, Doten, Taka, Norm, Jillian, Marcus, Mae, Novack, Esther, Perry, Dana, Ducot, Javier, Porter, Madison, Gecko, Dough, JR, Gisele, Crimp, Norie, Arch, Kimi, Fisher, Barbara, Jason, Peggy, Bernard, Jules, Leroy, Eva, Khederian, Campbell, Vogt, Masido, Karel, Torres, Lo, Breezer, Delby, Rountree, Anna, Servus, Rue, Itiaes, Chuck, Luna, Novella, Zaza, Wen, Gino, Lex, Cassandra, Limey, Nancy, Anukul, Silver, Brodesky, Jinsai, Squid, Gez, Rakesh, Ladan, Edelman, Marcet, Squire, Tatem, Tony, Jerm, Tia, Falcon, BK, Tiggs, Driscoll, Bacon, Timothee, Cru, Carmilla, Coyot, Webb, Kazu, Rudas, LJ, Sea, Ali Wallace, Bewest, Pup, Drub, Dragon, Inoshiro, Byron, Rhett, Xandix, Aimee, Fredrik, Thor, Teddy, Baron, Nelly, Ghengis, Epic, Eli, Stone, Grapes, Irie, Prep, Scobu, Valerie, Alain, and many others.
-Tak til følgende beboere for at sikre at denne klient er den bedste version indtil nu: (under udarbejdelse)
+Tak til følgende beboere: Drew Dwi, Zai Lynch, Latif Khalifa, Ellla McMahon, Harleen Gretzky, Squirrel Wood, Malarthi Behemoth, Dante Tucker, Buckaroo Mu, Eddi Decosta, Dirk, Talamasca, Torben Trautman, Irene Muni, Lilly Zenovka, Vick Forcella, Sasy Scarborough, Gentle Welinder, Elric Anatine, Techwolf Lupindo, Dusan Writer, WolfPup Lowenhar, Marianne McCann, Fiachra Lach, Sitearm Madonna, Sudane Erato, Sahkolihaa Contepomi, Sachi Vixen, Questar Utu, Dimitrio Lewis, Matto Destiny, Scrim Pinion, Radio Signals, Psi Merlin, Pixel Gausman, Mel Vanbeeck, Laurent Bechir, Lamorna Proctor, Lares Carter, Gwyneth Llewelyn, Hydra Shaftoe, Holger Gilruth, Gentle Heron, Carla Broek, Boroondas Gupte, Fury Rosewood, Flower Ducatillon, Colpo Wexler, gwampa Lomu, Borg Capalini, Beansy Twine, Ardy Lay, , 45ms Zhong, Adeon Writer, Aeonix Aeon, Ai Austin, Aiko Ying, Alexandrea Fride, Alliez Mysterio, Annie Milestone, Annika Genezzia, Ansariel Hiller, ArminasX Saiman, Arya Braveheart, Asaeda Meltingdots, Asturkon Jua, Avallyn Oakleaf, Avatar Quinzet, BabyA Littlething, Bacchus Ireto, Bazaar, Riva, Benjamin Bigdipper, Beth Walcher, Bezilon Kasei, Biancaluce Robbiani, Bill Walach, blakopal Galicia, Blitzckreed Levenque, Bryn Oh, Callipygian Christensen, Cap Carver, Carr Arbenlow, Chantal Harvey, Charles Courtois, Charlie Sazaland, Cherry Cheevers, ChickyBabes Zuzu, Christopher Organiser, Ciaran Laval, Clara Young, Celierra Darling, Corinne Helendale, Corro Moseley, Coughdrop Littlething, Darien Caldwell, Dartagan Shepherd, Debs Regent, Decro Schmooz, Denim Kamachi, DiJodi Dubratt, Dil Spitz, Edgware Marker, Egehan Dryke, Emma Portilo, Emmie Fairymeadow, Evangelista Emerald, Faelon Swordthain, Frenchimmo Sabra, Gaberoonie Zanzibar, Ganymedes Costagravas, Gene Frostbite, GeneJ Composer, Giggles Littlebird, Grady Echegaray, Guni Greenstein, Gypsy Tripsa, Hackshaven Harford, Ham Rambler, Han Shuffle, Hanglow Short, Hatzfeld Runo, herina Bode, Horatio Freund, Hypatia Callisto, Hypatia Pickens, Identity Euler, Imnotgoing Sideways, Innula Zenovka, Iyoba Tarantal, Jack Abraham, Jagga Meredith, Jennifer Boyle, Jeremy Marquez, Jessica Qin, Jinx Nordberg, Jo Bernandes, Jocial Sonnenkern, Joel Savard, Jondan Lundquist, Josef Munster, Josette Windlow, Juilan Tripsa, Juro Kothari, Justin RiversRunRed, Kagehi Kohn, Kaimen Takahe, Keklily Longfall, Ken Lavender, Kestral Karas, Khisme Nitely, Kimar Coba, Kithrak Kirkorian, Kitty Barnett, Kolor Fall, Komiko Okamoto, Korvel Noh, Larry Pixel, Leal Choche, len Starship, Lenae Munz, Lexi Frua, Lillie Cordeaux, Lizzy Macarthur, LSL Scientist, Luban Yiyuan, Luc Starsider, Maccus McCullough, Madison Blanc, Maggie Darwin, Mallory Destiny, Manx Wharton, Marc Claridge, Marc2 Sands, Matthew Anthony, Maxim RiversRunRed, Medhue Simoni, Melinda Latynina, Mencius Watts, Michi Lumin, Midian Farspire, Miles Glaz, Mindy Mathy, Mitch Wagner, Mo Hax, Mourna Biziou, Nao Noe, naofan Teardrop, Naomah Beaumont, Nathiel Siamendes, Nber Medici, Neko Link, Netpat Igaly, Neutron Chesnokov, Newfie Pendragon, Nicholai Laviscu, Nick Rhodes, Nicoladie Gymnast, Ollie Kubrick, Orenj Marat, Orion Delphis, Oryx Tempel, Parvati Silverweb, PeterPunk Mooney, Pixel Scientist, Pounce Teazle, Professor Noarlunga, Quantum Destiny, Quicksilver Hermes, Ralf Setsuko, RAT Quan, RedMokum Bravin, Revolution Perenti, Rezit Sideways, Rich Grainger, Rosco Teardrop, Rose Evans, Rudee Voom, RufusTT Horsefly, Saii Hallard, SaintLEOlions Zimer, Samm Larkham, Satanello Miami, SexySteven Morrisey, Sheet Spotter, Shnurui Troughton, sicarius Thorne, Sicarius Toxx, Sini Nubalo, SLB Wirefly, snowy Sidran, Soupa Segura, ST Mensing, Starshine Halasy, Stickman Ingmann, Synystyr Texan, Takeda Terrawyng, Tali Rosca, Templar Merlin, Tezcatlipoca Bisiani, Tiel Stonecutter, Tony Kembia, TouchaHoney Perhaps, Trey Reanimator, TriloByte Zanzibar, Trinity Dechou, Trinity Dejavu, Unlikely Quintessa, UsikuFarasi Kanarik, Veritas Raymaker, Vex Streeter, Viaticus Speculaas, Villain Baroque, Vixie Durant, Void Singer, Watty Berkson, Westley Schridde, Westley Streeter, Whimsy Winx, Winter Ventura, Wundur Primbee, xstorm Radek, YongYong Francois, Zak Westminster, Zana Kohime, Zaren Alexander, Zeja Pyle, ZenMondo Wormser, Zoex Flanagan, and many others.
+
+
+
+
+&quot;The work goes on, the cause endures, the hope still lives, and the dreams shall never die&quot; - Edward Kennedy
</text_editor>
</panel>
<panel label="Licenser" name="licenses_panel">
diff --git a/indra/newview/skins/default/xui/da/floater_animation_preview.xml b/indra/newview/skins/default/xui/da/floater_animation_preview.xml
index fdbfd737ba..adf96841c0 100644
--- a/indra/newview/skins/default/xui/da/floater_animation_preview.xml
+++ b/indra/newview/skins/default/xui/da/floater_animation_preview.xml
@@ -141,35 +141,35 @@ Maksimal animations længde er [MAX_LENGTH] sekunder.
Ansigtsudtryk
</text>
<combo_box label="" name="emote_combo" tool_tip="Angiver hvad ansigtet gør under animationen" width="140">
- <combo_box.item label="(Intet)" name="[None]"/>
- <combo_box.item label="Aaaaah" name="Aaaaah"/>
- <combo_box.item label="Bange" name="Afraid"/>
- <combo_box.item label="Vred" name="Angry"/>
- <combo_box.item label="Stort smil" name="BigSmile"/>
- <combo_box.item label="Keder sig" name="Bored"/>
- <combo_box.item label="Græder" name="Cry"/>
- <combo_box.item label="Forarget" name="Disdain"/>
- <combo_box.item label="Flov" name="Embarrassed"/>
- <combo_box.item label="Skuler" name="Frown"/>
- <combo_box.item label="Kysser" name="Kiss"/>
- <combo_box.item label="Griner" name="Laugh"/>
- <combo_box.item label="Plllppt" name="Plllppt"/>
- <combo_box.item label="Frastødt" name="Repulsed"/>
- <combo_box.item label="Ked af det" name="Sad"/>
- <combo_box.item label="Skuldertræk" name="Shrug"/>
- <combo_box.item label="Smil" name="Smile"/>
- <combo_box.item label="Overrasket" name="Surprise"/>
- <combo_box.item label="Blinker" name="Wink"/>
- <combo_box.item label="Bekymret" name="Worry"/>
+ <item label="(Intet)" name="[None]" value=""/>
+ <item label="Aaaaah" name="Aaaaah" value="Aaaaah"/>
+ <item label="Bange" name="Afraid" value="Bange"/>
+ <item label="Vred" name="Angry" value="Vred"/>
+ <item label="Stort smil" name="BigSmile" value="Stort smil"/>
+ <item label="Keder sig" name="Bored" value="Keder sig"/>
+ <item label="Græder" name="Cry" value="Grædende"/>
+ <item label="Forarget" name="Disdain" value="Foragt"/>
+ <item label="Flov" name="Embarrassed" value="Embarrassed"/>
+ <item label="Skuler" name="Frown" value="Alvorlig"/>
+ <item label="Kysser" name="Kiss" value="Kys"/>
+ <item label="Griner" name="Laugh" value="Leende"/>
+ <item label="Plllppt" name="Plllppt" value="Plllppt"/>
+ <item label="Frastødt" name="Repulsed" value="Frastødt"/>
+ <item label="Ked af det" name="Sad" value="Ked af det"/>
+ <item label="Skuldertræk" name="Shrug" value="Skuldertræk"/>
+ <item label="Smil" name="Smile" value="Smilende"/>
+ <item label="Overrasket" name="Surprise" value="Overrasket"/>
+ <item label="Blinker" name="Wink" value="Blink"/>
+ <item label="Bekymret" name="Worry" value="Bekymret"/>
</combo_box>
<text name="preview_label">
Vis mens
</text>
<combo_box label="" name="preview_base_anim" tool_tip="Se hvordan animation ser ud i forskellige typiske avatar-situationer." width="140">
- <combo_box.item label="Stående" name="Standing"/>
- <combo_box.item label="Gående" name="Walking"/>
- <combo_box.item label="Sidder" name="Sitting"/>
- <combo_box.item label="Flyver" name="Flying"/>
+ <item label="Stående" name="Standing" value="Stående"/>
+ <item label="Gående" name="Walking" value="Gående"/>
+ <item label="Sidder" name="Sitting" value="Siddende"/>
+ <item label="Flyver" name="Flying" value="Flyvende"/>
</combo_box>
<spinner label="start (sec)" name="ease_in_time" tool_tip="Tid (i sekunder) animationen bruger på at komme i gang."/>
<spinner label="Afslut (sec)" name="ease_out_time" tool_tip="Tid (i sekunder) animationen bruger på at afslutte"/>
diff --git a/indra/newview/skins/default/xui/da/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/da/floater_day_cycle_options.xml
index 94cf4546e3..ffae3d788f 100644
--- a/indra/newview/skins/default/xui/da/floater_day_cycle_options.xml
+++ b/indra/newview/skins/default/xui/da/floater_day_cycle_options.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<floater name="Day Cycle Floater" title="DAG CYKLUS OPSÆTNING">
<tab_container name="Day Cycle Tabs">
<panel label="Dag cyklus" name="Day Cycle">
- <button label="?" name="WLDayCycleHelp" />
- <multi_slider label="" name="WLTimeSlider" />
- <multi_slider label="" name="WLDayCycleKeys" />
+ <button label="?" name="WLDayCycleHelp"/>
+ <multi_slider label="" name="WLTimeSlider"/>
+ <multi_slider label="" name="WLDayCycleKeys"/>
<text name="WL12am">
00:00
</text>
@@ -59,39 +59,38 @@
<text name="WL12amHash2">
|
</text>
- <button label="Tilføj key" label_selected="Tilføj key" name="WLAddKey" />
- <button label="Slet key" label_selected="Slet key" name="WLDeleteKey" />
+ <button label="Tilføj key" label_selected="Tilføj key" name="WLAddKey"/>
+ <button label="Slet key" label_selected="Slet key" name="WLDeleteKey"/>
<text name="WLCurKeyFrameText">
Key-frame indstillinger:
</text>
<text name="WLCurKeyTimeText">
Key tid:
</text>
- <spinner label="Timer" name="WLCurKeyHour" />
- <spinner label="Min." name="WLCurKeyMin" />
+ <spinner label="Timer" name="WLCurKeyHour"/>
+ <spinner label="Min." name="WLCurKeyMin"/>
<text name="WLCurKeyTimeText2">
Key fast indstilling:
</text>
- <combo_box label="Faste" name="WLKeyPresets" />
+ <combo_box label="Faste" name="WLKeyPresets"/>
<text name="DayCycleText">
Snap:
</text>
- <combo_box label="5 min" name="WLSnapOptions" />
+ <combo_box label="5 min" name="WLSnapOptions"/>
<text name="DayCycleText2">
Cycluslængde:
</text>
- <spinner label="Timer" name="WLLengthOfDayHour" />
- <spinner label="Min." name="WLLengthOfDayMin" />
- <spinner label="Sek." name="WLLengthOfDaySec" />
+ <spinner label="Timer" name="WLLengthOfDayHour"/>
+ <spinner label="Min." name="WLLengthOfDayMin"/>
+ <spinner label="Sek." name="WLLengthOfDaySec"/>
<text name="DayCycleText3">
- Vis:
- </text>
- <button label="Afspil" label_selected="Afspil" name="WLAnimSky" />
- <button label="Stop!" label_selected="Stop" name="WLStopAnimSky" />
- <button label="Benyt estate tid" label_selected="Gå til estate tid"
- name="WLUseLindenTime" />
- <button label="Gem test-dag" label_selected="Gem test-dag" name="WLSaveDayCycle" />
- <button label="Hent test-dag" label_selected="Hent test-dag" name="WLLoadDayCycle" />
+ Vis :
+ </text>
+ <button label="Afspil" label_selected="Afspil" name="WLAnimSky"/>
+ <button label="Stop!" label_selected="Stop" name="WLStopAnimSky"/>
+ <button label="Benyt estate tid" label_selected="Gå til estate tid" name="WLUseLindenTime"/>
+ <button label="Gem test-dag" label_selected="Gem test-dag" name="WLSaveDayCycle"/>
+ <button label="Hent test-dag" label_selected="Hent test-dag" name="WLLoadDayCycle"/>
</panel>
</tab_container>
</floater>
diff --git a/indra/newview/skins/default/xui/da/floater_god_tools.xml b/indra/newview/skins/default/xui/da/floater_god_tools.xml
index 6b7f9ef209..5d3453e327 100644
--- a/indra/newview/skins/default/xui/da/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/da/floater_god_tools.xml
@@ -1,11 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<floater name="godtools floater" title="GOD TOOLS">
<tab_container name="GodTools Tabs">
- <panel label="Grid" name="grid">
- <button label="Spark alle beboere" label_selected="Spark alle beboere" name="Kick all users"/>
- </panel>
+ <panel label="Grid" name="grid"/>
<panel label="Region" name="region">
+ <text name="Region Name:">
+ Region Name:
+ </text>
<check_box label="Reset Home On Teleport" name="check reset home" tool_tip="Når beboere teleporterer væk, så sæt deres hjemmeadresse til deres destinations position."/>
</panel>
+ <panel label="Objects" name="objects">
+ <text name="Region Name:">
+ Region navn:
+ </text>
+ </panel>
</tab_container>
</floater>
diff --git a/indra/newview/skins/default/xui/da/floater_image_preview.xml b/indra/newview/skins/default/xui/da/floater_image_preview.xml
index 52fd9f80c0..5355127ef5 100644
--- a/indra/newview/skins/default/xui/da/floater_image_preview.xml
+++ b/indra/newview/skins/default/xui/da/floater_image_preview.xml
@@ -10,16 +10,16 @@
Se billede som:
</text>
<combo_box label="Tøj type" name="clothing_type_combo">
- <combo_box.item label="Billede" name="Image"/>
- <combo_box.item label="Hår" name="Hair"/>
- <combo_box.item label="Kvinde - hoved" name="FemaleHead"/>
- <combo_box.item label="Kvinde - overkrop" name="FemaleUpperBody"/>
- <combo_box.item label="Kvinde - underkrop" name="FemaleLowerBody"/>
- <combo_box.item label="Mand - hoved" name="MaleHead"/>
- <combo_box.item label="Mand - overkrop" name="MaleUpperBody"/>
- <combo_box.item label="Mand - underkrop" name="MaleLowerBody"/>
- <combo_box.item label="Nederdel" name="Skirt"/>
- <combo_box.item label="Sculpted Prim" name="SculptedPrim"/>
+ <item label="Billede" name="Image" value="Billede"/>
+ <item label="Hår" name="Hair" value="Hår"/>
+ <item label="Kvinde - hoved" name="FemaleHead" value="Hoved - kvinde"/>
+ <item label="Kvinde - overkrop" name="FemaleUpperBody" value="Overkrop - kvinde"/>
+ <item label="Kvinde - underkrop" name="FemaleLowerBody" value="Underkrop - kvinde"/>
+ <item label="Mand - hoved" name="MaleHead" value="Hoved - mand"/>
+ <item label="Mand - overkrop" name="MaleUpperBody" value="Overkrop - mand"/>
+ <item label="Mand - underkrop" name="MaleLowerBody" value="Underkrop - mand"/>
+ <item label="Nederdel" name="Skirt" value="Nederdel"/>
+ <item label="Sculpted Prim" name="SculptedPrim" value="Sculpted prim"/>
</combo_box>
<text name="bad_image_text">
Kunne ikke læse billede.
diff --git a/indra/newview/skins/default/xui/da/floater_outgoing_call.xml b/indra/newview/skins/default/xui/da/floater_outgoing_call.xml
index ef4e22dd8f..a5545668a2 100644
--- a/indra/newview/skins/default/xui/da/floater_outgoing_call.xml
+++ b/indra/newview/skins/default/xui/da/floater_outgoing_call.xml
@@ -28,7 +28,7 @@
Du er blevet koblet af fra [VOICE_CHANNEL_NAME]. [RECONNECT_NEARBY]
</text>
<text name="nearby_P2P_by_other">
- [VOICE_CHANNEL_NAME] har afsluttet opkaldet. [RECONNECT_NEARBY]
+ Dit kald er afsluttet. [RECONNECT_NEARBY]
</text>
<text name="nearby_P2P_by_agent">
Du har afsluttet opkaldet. [RECONNECT_NEARBY]
diff --git a/indra/newview/skins/default/xui/da/floater_snapshot.xml b/indra/newview/skins/default/xui/da/floater_snapshot.xml
index 6140055d74..7f7fb8ddf0 100644
--- a/indra/newview/skins/default/xui/da/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/da/floater_snapshot.xml
@@ -1,79 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Snapshot" title="FOTO FORHÅNDSVINSNING">
- <text name="type_label">
- Hvor skal foto hen?
- </text>
- <radio_group label="Snapshot type" name="snapshot_type_radio">
- <radio_item label="Email" name="postcard"/>
- <radio_item label="Min beholdning (L$[AMOUNT])" name="texture"/>
- <radio_item label="Gem på min computer" name="local"/>
- </radio_group>
- <text name="file_size_label">
- [SIZE] KB
- </text>
- <button label="Tag nyt foto" name="new_snapshot_btn"/>
- <button label="Send" name="send_btn"/>
- <button label="Gem (L$[AMOUNT])" name="upload_btn"/>
- <flyout_button label="Gem" name="save_btn" tool_tip="Gem billede i på din computer">
- <flyout_button_item label="Gem" name="save_item"/>
- <flyout_button_item label="Gem som..." name="saveas_item"/>
- </flyout_button>
- <button label="Annullér" name="discard_btn"/>
- <button label="Mere" name="more_btn" tool_tip="Avancerede muligheder"/>
- <button label="Mindre" name="less_btn" tool_tip="Avancerede muligheder"/>
- <text name="type_label2">
- Størrelse
- </text>
- <text name="format_label">
- Format
- </text>
- <combo_box label="Opløsning" name="postcard_size_combo">
- <combo_box.item label="Aktuelle vindue" name="CurrentWindow"/>
- <combo_box.item label="640x480" name="640x480"/>
- <combo_box.item label="800x600" name="800x600"/>
- <combo_box.item label="1024x768" name="1024x768"/>
- <combo_box.item label="Manuel" name="Custom"/>
- </combo_box>
- <combo_box label="Opløsning" name="texture_size_combo">
- <combo_box.item label="Aktuelle vindue" name="CurrentWindow"/>
- <combo_box.item label="Lille (128x128)" name="Small(128x128)"/>
- <combo_box.item label="Medium (256x256)" name="Medium(256x256)"/>
- <combo_box.item label="Stor (512x512)" name="Large(512x512)"/>
- <combo_box.item label="Manuel" name="Custom"/>
- </combo_box>
- <combo_box label="Opløsning" name="local_size_combo">
- <combo_box.item label="Aktuelle vindue" name="CurrentWindow"/>
- <combo_box.item label="320x240" name="320x240"/>
- <combo_box.item label="640x480" name="640x480"/>
- <combo_box.item label="800x600" name="800x600"/>
- <combo_box.item label="1024x768" name="1024x768"/>
- <combo_box.item label="1280x1024" name="1280x1024"/>
- <combo_box.item label="1600x1200" name="1600x1200"/>
- <combo_box.item label="Manuelt" name="Custom"/>
- </combo_box>
- <combo_box label="Fil-format" name="local_format_combo" width="76">
- <combo_box.item label="PNG" name="PNG"/>
- <combo_box.item label="JPEG" name="JPEG"/>
- <combo_box.item label="BMP" name="BMP"/>
- </combo_box>
- <spinner label="Bredde" label_width="41" name="snapshot_width" width="101"/>
- <spinner label="Højde" label_width="32" left="117" name="snapshot_height" width="92"/>
- <check_box label="Fasthold proportioner" name="keep_aspect_check"/>
- <slider label="Billedkvalitet" name="image_quality_slider"/>
- <text name="layer_type_label">
- Benyt:
- </text>
- <combo_box label="Billedlag" name="layer_types">
- <combo_box.item label="Farver" name="Colors"/>
- <combo_box.item label="Dybde" name="Depth"/>
- <combo_box.item label="Materinger" name="ObjectMattes"/>
- </combo_box>
- <check_box label="Snitflade" name="ui_check"/>
- <check_box label="HUDs" name="hud_check"/>
- <check_box label="Luk ikke vindue ved gemning" name="keep_open_check"/>
- <check_box label="Fastfrys (fuldt billede)" name="freeze_frame_check"/>
- <check_box label="Auto-opdater" name="auto_snapshot_check"/>
- <string name="unknown">
+<floater name="Snapshot" title="Foto">
+ <floater.string name="unknown">
ukendt
- </string>
+ </floater.string>
+ <button label="Tag nyt foto" name="new_snapshot_btn"/>
+ <line_editor label="Beskrivelse" name="description"/>
+ <button label="Del foto" name="share"/>
+ <button label="Del på internettet" name="share_to_web"/>
+ <button label="Gem til beholdning" name="save_to_inventory"/>
+ <button label="Gem foto" name="save"/>
+ <button label="Email foto" name="share_to_email"/>
+ <button label="Gem på computer" name="save_to_computer"/>
+ <button label="Sæt som profil billede" name="set_profile_pic"/>
+ <button label="Tilbage" name="cancel"/>
</floater>
diff --git a/indra/newview/skins/default/xui/da/floater_tos.xml b/indra/newview/skins/default/xui/da/floater_tos.xml
index c87fe8162f..760f60c996 100644
--- a/indra/newview/skins/default/xui/da/floater_tos.xml
+++ b/indra/newview/skins/default/xui/da/floater_tos.xml
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<floater name="modal container" title="">
+ <floater.string name="real_url">
+ http://secondlife.com/app/tos/
+ </floater.string>
+ <floater.string name="loading_url">
+ data:text/html,%3Chtml%3E%3Chead%3E%3C/head%3E%3Cbody text=%22000000%22%3E%3Ch2%3E Loading %3Ca%20target%3D%22_external%22%20href%3D%22http%3A//secondlife.com/app/tos/%22%3ETerms%20of%20Service%3C/a%3E...%3C/h2%3E %3C/body%3E %3C/html%3E
+ </floater.string>
<button label="Fortsæt" label_selected="Fortsæt" name="Continue"/>
<button label="Annullér" label_selected="Annullér" name="Cancel"/>
<check_box label="Jeg er enig med &quot;Terms of Service and Privacy Policy&quot;" name="agree_chk"/>
<text name="tos_heading">
Læs venligst følgende &quot;Terms of Service and Privacy Policy&quot; grundigt. For at fortsætte med at logge på [SECOND_LIFE], skal du acceptere aftale.
</text>
- <text_editor name="tos_text">
- TOS_TEXT
- </text_editor>
- <string name="real_url">
- http://secondlife.com/app/tos/
- </string>
</floater>
diff --git a/indra/newview/skins/default/xui/da/menu_attachment_other.xml b/indra/newview/skins/default/xui/da/menu_attachment_other.xml
index 2cc23e27c7..ca7b184942 100644
--- a/indra/newview/skins/default/xui/da/menu_attachment_other.xml
+++ b/indra/newview/skins/default/xui/da/menu_attachment_other.xml
@@ -10,7 +10,7 @@
<menu_item_call label="Rapportér" name="abuse"/>
<menu_item_call label="Frys" name="Freeze..."/>
<menu_item_call label="Smid ud" name="Eject..."/>
- <menu_item_call label="Debug" name="Debug..."/>
+ <menu_item_call label="Debug teksturer" name="Debug..."/>
<menu_item_call label="Zoom ind" name="Zoom In"/>
<menu_item_call label="Betal" name="Pay..."/>
<menu_item_call label="Objekt profil" name="Object Inspect"/>
diff --git a/indra/newview/skins/default/xui/da/menu_attachment_self.xml b/indra/newview/skins/default/xui/da/menu_attachment_self.xml
index 306ae96d49..d8bd78fa23 100644
--- a/indra/newview/skins/default/xui/da/menu_attachment_self.xml
+++ b/indra/newview/skins/default/xui/da/menu_attachment_self.xml
@@ -9,4 +9,5 @@
<menu_item_call label="Venner" name="Friends..."/>
<menu_item_call label="Grupper" name="Groups..."/>
<menu_item_call label="Profil" name="Profile..."/>
+ <menu_item_call label="Debug teksturer" name="Debug..."/>
</context_menu>
diff --git a/indra/newview/skins/default/xui/da/menu_avatar_other.xml b/indra/newview/skins/default/xui/da/menu_avatar_other.xml
index 66d357e7e2..a778dedf0b 100644
--- a/indra/newview/skins/default/xui/da/menu_avatar_other.xml
+++ b/indra/newview/skins/default/xui/da/menu_avatar_other.xml
@@ -10,7 +10,7 @@
<menu_item_call label="Rapportér" name="abuse"/>
<menu_item_call label="Frys" name="Freeze..."/>
<menu_item_call label="Smid ud" name="Eject..."/>
- <menu_item_call label="Debug" name="Debug..."/>
+ <menu_item_call label="Debug Teksturer" name="Debug..."/>
<menu_item_call label="Zoom ind" name="Zoom In"/>
<menu_item_call label="Betal" name="Pay..."/>
</context_menu>
diff --git a/indra/newview/skins/default/xui/da/menu_avatar_self.xml b/indra/newview/skins/default/xui/da/menu_avatar_self.xml
index 6a6831c2e3..39f3e49702 100644
--- a/indra/newview/skins/default/xui/da/menu_avatar_self.xml
+++ b/indra/newview/skins/default/xui/da/menu_avatar_self.xml
@@ -24,4 +24,5 @@
<menu_item_call label="Venner" name="Friends..."/>
<menu_item_call label="Grupper" name="Groups..."/>
<menu_item_call label="Profil" name="Profile..."/>
+ <menu_item_call label="Debug teksturer" name="Debug..."/>
</context_menu>
diff --git a/indra/newview/skins/default/xui/da/menu_edit.xml b/indra/newview/skins/default/xui/da/menu_edit.xml
new file mode 100644
index 0000000000..3752f42b1c
--- /dev/null
+++ b/indra/newview/skins/default/xui/da/menu_edit.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<menu label="Redigér" name="Edit">
+ <menu_item_call label="Fortryd" name="Undo"/>
+ <menu_item_call label="Gendan" name="Redo"/>
+ <menu_item_call label="Klip" name="Cut"/>
+ <menu_item_call label="Kopiér" name="Copy"/>
+ <menu_item_call label="Sæt ind" name="Paste"/>
+ <menu_item_call label="Slet" name="Delete"/>
+ <menu_item_call label="Duplikér" name="Duplicate"/>
+ <menu_item_call label="Marker alt" name="Select All"/>
+ <menu_item_call label="Fjern markering" name="Deselect"/>
+</menu>
diff --git a/indra/newview/skins/default/xui/da/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/da/menu_inspect_avatar_gear.xml
index 7434f2c3a2..89111d49f1 100644
--- a/indra/newview/skins/default/xui/da/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/da/menu_inspect_avatar_gear.xml
@@ -11,7 +11,7 @@
<menu_item_call label="Rapportér" name="report"/>
<menu_item_call label="Frys" name="freeze"/>
<menu_item_call label="Smid ud" name="eject"/>
- <menu_item_call label="Debug" name="debug"/>
+ <menu_item_call label="Debug teksturer" name="debug"/>
<menu_item_call label="Find på kort" name="find_on_map"/>
<menu_item_call label="Zoom ind" name="zoom_in"/>
<menu_item_call label="Betal" name="pay"/>
diff --git a/indra/newview/skins/default/xui/da/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/da/menu_inspect_self_gear.xml
index cfe455e21d..aeef2ccb23 100644
--- a/indra/newview/skins/default/xui/da/menu_inspect_self_gear.xml
+++ b/indra/newview/skins/default/xui/da/menu_inspect_self_gear.xml
@@ -5,4 +5,5 @@
<menu_item_call label="Profil" name="my_profile"/>
<menu_item_call label="Venner" name="my_friends"/>
<menu_item_call label="Grupper" name="my_groups"/>
+ <menu_item_call label="Debug teksturer" name="Debug..."/>
</menu>
diff --git a/indra/newview/skins/default/xui/da/menu_inv_offer_chiclet.xml b/indra/newview/skins/default/xui/da/menu_inv_offer_chiclet.xml
new file mode 100644
index 0000000000..c3b03232bf
--- /dev/null
+++ b/indra/newview/skins/default/xui/da/menu_inv_offer_chiclet.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<menu name="InvOfferChiclet Menu">
+ <menu_item_call label="Luk" name="Close"/>
+</menu>
diff --git a/indra/newview/skins/default/xui/da/menu_inventory.xml b/indra/newview/skins/default/xui/da/menu_inventory.xml
index cdfcad9b1c..0ea21dc409 100644
--- a/indra/newview/skins/default/xui/da/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/da/menu_inventory.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<menu name="Popup">
+ <menu_item_call label="Del" name="Share"/>
<menu_item_call label="Køb" name="Task Buy"/>
<menu_item_call label="åben" name="Task Open"/>
<menu_item_call label="Afspil" name="Task Play"/>
diff --git a/indra/newview/skins/default/xui/da/menu_login.xml b/indra/newview/skins/default/xui/da/menu_login.xml
index 7fc7d43c20..36e82e8bc4 100644
--- a/indra/newview/skins/default/xui/da/menu_login.xml
+++ b/indra/newview/skins/default/xui/da/menu_login.xml
@@ -6,19 +6,10 @@
</menu>
<menu label="Hjælp" name="Help">
<menu_item_call label="[SECOND_LIFE] hjælp" name="Second Life Help"/>
+ <menu_item_call label="Om [APP_NAME]" name="About Second Life"/>
</menu>
+ <menu_item_check label="Vis debug menu" name="Show Debug Menu"/>
<menu label="Debug" name="Debug">
- <menu label="Redigér" name="Edit">
- <menu_item_call label="Fortryd" name="Undo"/>
- <menu_item_call label="Gendan" name="Redo"/>
- <menu_item_call label="Klip" name="Cut"/>
- <menu_item_call label="Kopiér" name="Copy"/>
- <menu_item_call label="Sæt ind" name="Paste"/>
- <menu_item_call label="Slet" name="Delete"/>
- <menu_item_call label="Duplikér" name="Duplicate"/>
- <menu_item_call label="Vælg alle" name="Select All"/>
- <menu_item_call label="Vælg intet" name="Deselect"/>
- </menu>
<menu_item_call label="Vis debug opsætning" name="Debug Settings"/>
<menu_item_call label="UI/farve opsætning" name="UI/Color Settings"/>
<menu label="UI tests" name="UI Tests"/>
@@ -26,5 +17,7 @@
<menu_item_call label="Vis betingelser" name="TOS"/>
<menu_item_call label="Vis vigtig besked" name="Critical"/>
<menu_item_call label="Test i web browser" name="Web Browser Test"/>
+ <menu_item_check label="Vis gitter vælger" name="Show Grid Picker"/>
+ <menu_item_call label="Vis notifikationskonsol" name="Show Notifications Console"/>
</menu>
</menu_bar>
diff --git a/indra/newview/skins/default/xui/da/menu_participant_list.xml b/indra/newview/skins/default/xui/da/menu_participant_list.xml
index c2595dcb3d..02b7e8466b 100644
--- a/indra/newview/skins/default/xui/da/menu_participant_list.xml
+++ b/indra/newview/skins/default/xui/da/menu_participant_list.xml
@@ -8,6 +8,7 @@
<menu_item_call label="Opkald" name="Call"/>
<menu_item_call label="Del" name="Share"/>
<menu_item_call label="Betal" name="Pay"/>
+ <menu_item_check label="Se person ikoner" name="View Icons"/>
<menu_item_check label="Blokér stemme" name="Block/Unblock"/>
<menu_item_check label="Blokér tekst" name="MuteText"/>
<context_menu label="Moderator muligheder &gt;" name="Moderator Options">
diff --git a/indra/newview/skins/default/xui/da/menu_save_outfit.xml b/indra/newview/skins/default/xui/da/menu_save_outfit.xml
new file mode 100644
index 0000000000..3d89715ea8
--- /dev/null
+++ b/indra/newview/skins/default/xui/da/menu_save_outfit.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<toggleable_menu name="save_outfit_menu">
+ <menu_item_call label="Gem" name="save_outfit"/>
+ <menu_item_call label="Gem som ny" name="save_as_new_outfit"/>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/da/menu_script_chiclet.xml b/indra/newview/skins/default/xui/da/menu_script_chiclet.xml
new file mode 100644
index 0000000000..cdd3212373
--- /dev/null
+++ b/indra/newview/skins/default/xui/da/menu_script_chiclet.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<menu name="ScriptChiclet Menu">
+ <menu_item_call label="Luk" name="Close"/>
+</menu>
diff --git a/indra/newview/skins/default/xui/da/menu_viewer.xml b/indra/newview/skins/default/xui/da/menu_viewer.xml
index be57f88e8a..e195ebfeed 100644
--- a/indra/newview/skins/default/xui/da/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/da/menu_viewer.xml
@@ -29,6 +29,7 @@
<menu_item_call label="Foto" name="Take Snapshot"/>
<menu_item_call label="Opret landemærke for dette sted" name="Create Landmark Here"/>
<menu label="Profil for sted" name="Land">
+ <menu_item_call label="Profil for sted" name="Place Profile"/>
<menu_item_call label="Om land" name="About Land"/>
<menu_item_call label="Region/Estate" name="Region/Estate"/>
</menu>
@@ -64,17 +65,6 @@
<menu_item_call label="Byg værktøj" name="Create"/>
<menu_item_call label="Land værktøj" name="Land"/>
</menu>
- <menu label="Redigér" name="Edit">
- <menu_item_call label="Fortryd" name="Undo"/>
- <menu_item_call label="Gendan" name="Redo"/>
- <menu_item_call label="Klip" name="Cut"/>
- <menu_item_call label="Kopiér" name="Copy"/>
- <menu_item_call label="Sæt ind" name="Paste"/>
- <menu_item_call label="Slet" name="Delete"/>
- <menu_item_call label="Duplikér" name="Duplicate"/>
- <menu_item_call label="Vælg alt" name="Select All"/>
- <menu_item_call label="Fravælg" name="Deselect"/>
- </menu>
<menu_item_call label="Sammenkæd" name="Link"/>
<menu_item_call label="Adskil" name="Unlink"/>
<menu_item_check label="Redigér sammekædede objekter" name="Edit Linked Parts"/>
@@ -122,6 +112,7 @@
<menu_item_call label="Om [APP_NAME]" name="About Second Life"/>
</menu>
<menu label="Avanceret" name="Advanced">
+ <menu_item_check label="Vis avanceret menu" name="Show Advanced Menu"/>
<menu_item_call label="Stop animering af min avatar" name="Stop Animating My Avatar"/>
<menu_item_call label="Gendan teksturer" name="Rebake Texture"/>
<menu_item_call label="Sæt UI størrelse til standard" name="Set UI Size to Default"/>
@@ -143,7 +134,6 @@
<menu_item_check label="Fremhæv gennemsigtigt" name="Highlight Transparent"/>
<menu_item_check label="Vis HUD vedhæftninger" name="Show HUD Attachments"/>
<menu_item_check label="Vis muse-sigte" name="ShowCrosshairs"/>
- <menu_item_check label="Vis tips om land" name="Land Tips"/>
</menu>
<menu label="Gengivelsestyper" name="Rendering Types">
<menu_item_check label="Simpel" name="Simple"/>
@@ -169,7 +159,7 @@
<menu_item_check label="Tåge" name="Fog"/>
<menu_item_check label="Fleksible objekter" name="Flexible Objects"/>
</menu>
- <menu_item_check label="Kør flere 'threats'" name="Run Multiple Threads"/>
+ <menu_item_check label="Kør flere &apos;threats&apos;" name="Run Multiple Threads"/>
<menu_item_call label="Tøm gruppe cache" name="ClearGroupCache"/>
<menu_item_check label="Muse udjævning" name="Mouse Smoothing"/>
<menu label="Shortcuts" name="Shortcuts">
diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml
index 30e19ee901..afccc1e904 100644
--- a/indra/newview/skins/default/xui/da/notifications.xml
+++ b/indra/newview/skins/default/xui/da/notifications.xml
@@ -224,6 +224,9 @@ Er du sikker på at du vil fortsætte?
Ikke nok penge til at oprette annonce.
<usetemplate name="okbutton" yestext="OK"/>
</notification>
+ <notification name="DeleteAvatarPick">
+ Slet favorit &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
+ </notification>
<notification name="CacheWillClear">
Cache vil blive tømt ved næste genstart af [APP_NAME].
</notification>
@@ -391,6 +394,16 @@ Tilbyd venskab til [NAME]?
<button name="Cancel" text="Annullér"/>
</form>
</notification>
+ <notification label="Gem sæt" name="SaveOutfitAs">
+ Gem det som jeg har på som nyt sæt:
+ <form name="form">
+ <input name="message">
+ [DESC] (ny)
+ </input>
+ <button name="Offer" text="OK"/>
+ <button name="Cancel" text="Annullér"/>
+ </form>
+ </notification>
<notification name="ErrorMessage">
<usetemplate name="okbutton" yestext="OK"/>
</notification>
@@ -584,6 +597,10 @@ Chat og personlige beskeder vil blive skjult. Personlige beskeder vil få din &a
Teleport til [CLASSIFIED]?
<usetemplate ignoretext="Bekræft at du ønsker at teleportere til lokation in annoncer" name="okcancelignore" notext="Annullér" yestext="Teleport"/>
</notification>
+ <notification name="TeleportToHistoryEntry">
+ Teleport til [HISTORY_ENTRY]?
+ <usetemplate ignoretext="Bekræft at du ønsker at teleportere til en lokation i din historik" name="okcancelignore" notext="Annullér" yestext="Teleport"/>
+ </notification>
<notification label="Change Linden Estate" name="ChangeLindenEstate">
Du er i færd med at ændre et Linden ejet estate (mainland, teeen grid, orientation etc.).
@@ -619,6 +636,9 @@ Du kan klikke på &apos;Ændre præference&apos; for at ændre din indholdsratin
<ignore name="ignore" text="Din valgte indholdsrating forhindrer dig i at kommer til en region"/>
</form>
</notification>
+ <notification name="PreferredMaturityChanged">
+ Din indholdsrating er nu [RATING].
+ </notification>
<notification name="LandClaimAccessBlocked">
Du kan ikke kræve dette land på grund af din nuværende indholdsrating indstillinge . Dette kan skyldes manglende validering af din alder.
@@ -813,6 +833,9 @@ Henvis til dette fra en hjemmeside for at give andre nem adgang til denne lokati
<notification name="SystemMessageTip">
[MESSAGE]
</notification>
+ <notification name="IMSystemMessageTip">
+ [MESSAGE]
+ </notification>
<notification name="Cancelled">
Annulléret
</notification>
@@ -838,6 +861,11 @@ Henvis til dette fra en hjemmeside for at give andre nem adgang til denne lokati
Uploader billeder fra verdenen og www...
(Tager omkring 5 minutter.)
</notification>
+ <notification name="UploadConfirmation">
+ Omkostninger ved at sende: L$[AMOUNT].
+Ønsker du at fortsætte?
+ <usetemplate name="okcancelbuttons" notext="Annullér" yestext="Send"/>
+ </notification>
<notification name="UploadPayment">
Du betalte L$[AMOUNT] for at uploade.
</notification>
@@ -1180,9 +1208,9 @@ Prøv igen om lidt.
</form>
</notification>
<notification name="TeleportOffered">
- [NAME] har tilbudt dig en teleport til lokationen:
+ [NAME_SLURL] har tilbudt en teleport til deres lokation:
-[MESSAGE]
+[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
<form name="form">
<button name="Teleport" text="Teleportér"/>
<button name="Cancel" text="Annullér"/>
@@ -1200,9 +1228,11 @@ Prøv igen om lidt.
</form>
</notification>
<notification name="OfferFriendship">
- [NAME] tilbyder venskab.
+ [NAME_SLURL] tilbyder venskab.
-Som standard vil du kunne se andres onlinestatus.
+[MESSAGE]
+
+(Som udgangspunkt vil I være i stand til at se hinandens online status.)
<form name="form">
<button name="Accept" text="Acceptér"/>
<button name="Decline" text="Afvis"/>
@@ -1256,6 +1286,9 @@ Fra genstand: [OBJECTNAME], ejer: [NAME]?
<notification name="FailedToFindWearable">
Det lykkedes ikke at finde [TYPE] med navnet [DESC] i databasen.
</notification>
+ <notification name="ShareToWebFailed">
+ Fejl ved afsendelse af billede til web.
+ </notification>
<notification name="InvalidWearable">
Den genstand du prøver at tage på benytter en funktion din klient ikke kan forstå. Upgradér venligst din version af [APP_NAME] for at kunne tage denne genstand på.
</notification>
@@ -1451,6 +1484,12 @@ De vil blive blokeret nogle få sekunder af sikkerhedsmæssige årsager.
Den valgte knap kan ikke vises lige nu.
Knappen vil blive vist når der er nok plads til den.
</notification>
+ <notification name="ShareNotification">
+ Træk genstande fra beholdning til en person i beboer vælgeren
+ </notification>
+ <notification name="AvatarRezNotification">
+ Avatar &apos;[NAME]&apos; rezzed på [TIME] sekunder.
+ </notification>
<global name="UnsupportedGLRequirements">
Det ser ikke ud til at din hardware opfylder minimumskravene til [APP_NAME]. [APP_NAME] kræver et OpenGL grafikkort som understøter &apos;multitexture&apos;. Check eventuelt om du har de nyeste drivere for grafikkortet, og de nyeste service-packs og patches til dit operativsystem.
diff --git a/indra/newview/skins/default/xui/da/outfit_accordion_tab.xml b/indra/newview/skins/default/xui/da/outfit_accordion_tab.xml
new file mode 100644
index 0000000000..e2d1f26d42
--- /dev/null
+++ b/indra/newview/skins/default/xui/da/outfit_accordion_tab.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<!-- *NOTE: mantipov: this xml is intended to be used inside panel_outfits_list.xml for each outfit folder-->
+<!-- All accordion tabs in the My Appearance/My Outfits panel will be created from this one at runtume-->
+<accordion_tab name="Mockup Tab" title="Model fane"/>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_eyes.xml b/indra/newview/skins/default/xui/da/panel_edit_eyes.xml
index 9c0d77c370..d801118cea 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_eyes.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_eyes.xml
@@ -3,7 +3,9 @@
<panel name="avatar_eye_color_panel">
<texture_picker label="Iris" name="Iris" tool_tip="Klik for at vælge billede"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="eyes_main_tab" title="Øjne"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="eyes_main_tab" title="Øjne"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_gloves.xml b/indra/newview/skins/default/xui/da/panel_edit_gloves.xml
index 1d3ba061bc..837abdac80 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_gloves.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_gloves.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge bilede"/>
<color_swatch label="Farve/nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="gloves_main_tab" title="Handsker"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="gloves_main_tab" title="Handsker"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_hair.xml b/indra/newview/skins/default/xui/da/panel_edit_hair.xml
index 14511d51d5..e91e6324e8 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_hair.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_hair.xml
@@ -3,10 +3,12 @@
<panel name="avatar_hair_color_panel">
<texture_picker label="Tekstur" name="Texture" tool_tip="Klik for at vælge et billede"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="hair_color_tab" title="Farve"/>
- <accordion_tab name="hair_style_tab" title="Stil"/>
- <accordion_tab name="hair_eyebrows_tab" title="Øjenbryn"/>
- <accordion_tab name="hair_facial_tab" title="Skæg"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="hair_color_tab" title="Farve"/>
+ <accordion_tab name="hair_style_tab" title="Stil"/>
+ <accordion_tab name="hair_eyebrows_tab" title="Øjenbryn"/>
+ <accordion_tab name="hair_facial_tab" title="Ansigt"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_jacket.xml b/indra/newview/skins/default/xui/da/panel_edit_jacket.xml
index 4c9973c0bd..62934e96c8 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_jacket.xml
@@ -5,7 +5,9 @@
<texture_picker label="Stof forneden" name="Lower Fabric" tool_tip="Klik for at vælge et billede"/>
<color_swatch label="Farve/nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="jacket_main_tab" title="Jakke"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="jacket_main_tab" title="Jakke"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_pants.xml b/indra/newview/skins/default/xui/da/panel_edit_pants.xml
index bcb1450258..36a9bc60a9 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_pants.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_pants.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge et bilede"/>
<color_swatch label="Farve/Nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="pants_main_tab" title="Bukser"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="pants_main_tab" title="Bukser"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_shape.xml b/indra/newview/skins/default/xui/da/panel_edit_shape.xml
index 19c27748ca..1c8567d27c 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_shape.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_shape.xml
@@ -9,15 +9,17 @@
<radio_item label="Mand" name="radio2"/>
</radio_group>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="shape_body_tab" title="Krop"/>
- <accordion_tab name="shape_head_tab" title="Hoved"/>
- <accordion_tab name="shape_eyes_tab" title="Øjne"/>
- <accordion_tab name="shape_ears_tab" title="Ører"/>
- <accordion_tab name="shape_nose_tab" title="Næse"/>
- <accordion_tab name="shape_mouth_tab" title="Mund"/>
- <accordion_tab name="shape_chin_tab" title="Hage"/>
- <accordion_tab name="shape_torso_tab" title="Overkrop"/>
- <accordion_tab name="shape_legs_tab" title="Ben"/>
- </accordion>
+ <panel label="Trøje" name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="shape_body_tab" title="Krop"/>
+ <accordion_tab name="shape_head_tab" title="Hoved"/>
+ <accordion_tab name="shape_eyes_tab" title="Øjne"/>
+ <accordion_tab name="shape_ears_tab" title="Ører"/>
+ <accordion_tab name="shape_nose_tab" title="Næse"/>
+ <accordion_tab name="shape_mouth_tab" title="Mund"/>
+ <accordion_tab name="shape_chin_tab" title="Hage"/>
+ <accordion_tab name="shape_torso_tab" title="Overkrop"/>
+ <accordion_tab name="shape_legs_tab" title="Ben"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_shirt.xml b/indra/newview/skins/default/xui/da/panel_edit_shirt.xml
index cd2e8d8cb3..e49667dc8f 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_shirt.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_shirt.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge et billede"/>
<color_swatch label="Farve/Nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="shirt_main_tab" title="Trøje"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="shirt_main_tab" title="Trøje"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_shoes.xml b/indra/newview/skins/default/xui/da/panel_edit_shoes.xml
index 54a0cc01a4..00d31da95a 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_shoes.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_shoes.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge et billede"/>
<color_swatch label="Farve/nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="shoes_main_tab" title="Sko"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="shoes_main_tab" title="Shoes"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_skin.xml b/indra/newview/skins/default/xui/da/panel_edit_skin.xml
index 46dce354a9..608e1d6e0b 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_skin.xml
@@ -5,10 +5,12 @@
<texture_picker label="Øvre tatoveringer" name="Upper Tattoos" tool_tip="Klik for at vælge et bilede"/>
<texture_picker label="Nedre tatoveringer" name="Lower Tattoos" tool_tip="Klik for at vælge et bilede"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="skin_color_tab" title="Hudfarve"/>
- <accordion_tab name="skin_face_tab" title="Ansigtsdetaljer"/>
- <accordion_tab name="skin_makeup_tab" title="Makeup"/>
- <accordion_tab name="skin_body_tab" title="Kropsdetaljer"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="skin_color_tab" title="Hudfarve"/>
+ <accordion_tab name="skin_face_tab" title="Ansigtsdetaljer"/>
+ <accordion_tab name="skin_makeup_tab" title="Makeup"/>
+ <accordion_tab name="skin_body_tab" title="Kropsdetaljer"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_skirt.xml b/indra/newview/skins/default/xui/da/panel_edit_skirt.xml
index 4407c87d36..44a5beca45 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_skirt.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_skirt.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge et billede"/>
<color_swatch label="Farve/Nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="skirt_main_tab" title="Nederdel"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="skirt_main_tab" title="Nederdel"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_socks.xml b/indra/newview/skins/default/xui/da/panel_edit_socks.xml
index 6ef6dad86c..b7abd9d1a0 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_socks.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge et billede"/>
<color_swatch label="Farve/Nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="socks_main_tab" title="Strømper"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="socks_main_tab" title="Strømper"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_underpants.xml b/indra/newview/skins/default/xui/da/panel_edit_underpants.xml
index de52146e29..32596be57b 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_underpants.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_underpants.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge bilede"/>
<color_swatch label="Farve/nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="underpants_main_tab" title="Underbukser"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="underpants_main_tab" title="Underbukser"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_undershirt.xml b/indra/newview/skins/default/xui/da/panel_edit_undershirt.xml
index 6c2e1f5833..14cf79b97f 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_undershirt.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_undershirt.xml
@@ -4,7 +4,9 @@
<texture_picker label="Stof" name="Fabric" tool_tip="Klik for at vælge bilede"/>
<color_swatch label="Farve/nuance" name="Color/Tint" tool_tip="Klik for at åbne farvevælger"/>
</panel>
- <accordion name="wearable_accordion">
- <accordion_tab name="undershirt_main_tab" title="Undertrøje"/>
- </accordion>
+ <panel name="accordion_panel">
+ <accordion name="wearable_accordion">
+ <accordion_tab name="undershirt_main_tab" title="Undertrøje"/>
+ </accordion>
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_edit_wearable.xml b/indra/newview/skins/default/xui/da/panel_edit_wearable.xml
index 12bc120c45..4afb7ba45c 100644
--- a/indra/newview/skins/default/xui/da/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/da/panel_edit_wearable.xml
@@ -94,6 +94,11 @@
<panel label="Trøje" name="wearable_type_panel">
<text name="description_text" value="Kropsbygning:"/>
</panel>
+ <panel label="gear_buttom_panel" name="gear_buttom_panel">
+ <button name="friends_viewsort_btn" tool_tip="Valg"/>
+ <button name="add_btn" tool_tip="TODO"/>
+ <button name="del_btn" tool_tip="TODO"/>
+ </panel>
<panel name="button_panel">
<button label="Gem som" name="save_as_button"/>
<button label="Vend tilbage" name="revert_button"/>
diff --git a/indra/newview/skins/default/xui/da/panel_group_general.xml b/indra/newview/skins/default/xui/da/panel_group_general.xml
index becb5ab70a..3079a23d20 100644
--- a/indra/newview/skins/default/xui/da/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/da/panel_group_general.xml
@@ -45,8 +45,11 @@
<check_box label="Tilmeldingsgebyr" name="check_enrollment_fee" tool_tip="Angiver om der kræves et gebyr, for at tilmelde sig gruppen"/>
<spinner label="L$" left_delta="130" name="spin_enrollment_fee" tool_tip="Nye medlemmer skal betale dette gebyr for at tilmelde sig gruppen, når &quot;Tilmeldingsgebyr&quot; er valgt." width="60"/>
<combo_box name="group_mature_check" tool_tip="Angiver om din gruppes information anses som &apos;mature&apos;." width="150">
- <combo_box.item label="PG indhold" name="pg"/>
+ <combo_item name="select_mature">
+ - Vælg Mature -
+ </combo_item>
<combo_box.item label="Mature indhold" name="mature"/>
+ <combo_box.item label="PG indhold" name="pg"/>
</combo_box>
<check_box initial_value="true" label="Vis i søgning" name="show_in_group_list" tool_tip="Lad folk se denne gruppe i søgeresultater."/>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_im_control_panel.xml b/indra/newview/skins/default/xui/da/panel_im_control_panel.xml
index be9bfab1f6..5cecb93d40 100644
--- a/indra/newview/skins/default/xui/da/panel_im_control_panel.xml
+++ b/indra/newview/skins/default/xui/da/panel_im_control_panel.xml
@@ -20,7 +20,7 @@
<button label="Opkald" name="call_btn"/>
</layout_panel>
<layout_panel name="end_call_btn_panel">
- <button label="Forlad opkald" name="end_call_btn"/>
+ <button label="Afslut kald" name="end_call_btn"/>
</layout_panel>
<layout_panel name="voice_ctrls_btn_panel">
<button label="Stemme kontroller" name="voice_ctrls_btn"/>
diff --git a/indra/newview/skins/default/xui/da/panel_inventory_item.xml b/indra/newview/skins/default/xui/da/panel_inventory_item.xml
new file mode 100644
index 0000000000..d18047fbcf
--- /dev/null
+++ b/indra/newview/skins/default/xui/da/panel_inventory_item.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<panel name="inventory_item">
+ <text name="item_name" value="..."/>
+</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_media_settings_permissions.xml b/indra/newview/skins/default/xui/da/panel_media_settings_permissions.xml
index 70570920cd..84468eb2a7 100644
--- a/indra/newview/skins/default/xui/da/panel_media_settings_permissions.xml
+++ b/indra/newview/skins/default/xui/da/panel_media_settings_permissions.xml
@@ -11,10 +11,19 @@
Mini
</combo_item>
</combo_box>
+ <text name="owner_label">
+ Ejer
+ </text>
<check_box initial_value="false" label="Tillad navigation og interaktion" name="perms_owner_interact"/>
<check_box initial_value="false" label="Vis kontrol bjælke" name="perms_owner_control"/>
+ <text name="group_label">
+ Gruppe:
+ </text>
<check_box initial_value="false" label="Tillad navigation og interaktion" name="perms_group_interact"/>
<check_box initial_value="false" label="Vis kontrol bjælke" name="perms_group_control"/>
+ <text name="anyone_label">
+ Enhver
+ </text>
<check_box initial_value="false" label="Tillad navigation og interaktion" name="perms_anyone_interact"/>
<check_box initial_value="false" label="Vis kontrol bjælke" name="perms_anyone_control"/>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_nearby_media.xml b/indra/newview/skins/default/xui/da/panel_nearby_media.xml
index 7a8b5a6389..95bfc89f20 100644
--- a/indra/newview/skins/default/xui/da/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/da/panel_nearby_media.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<panel name="nearby_media">
+ <string name="media_item_count_format">
+ (%ld media items)
+ </string>
<string name="empty_item_text">
&lt;tom&gt;
</string>
@@ -16,15 +19,10 @@
<button label="Stop alt" name="all_nearby_media_disable_btn" tool_tip="Stop al media tæt på"/>
<button label="Start alt" name="all_nearby_media_enable_btn" tool_tip="Tænd al media tæt på"/>
<button name="open_prefs_btn" tool_tip="Vis media preferencer"/>
- <button label="Mere &gt;&gt;" label_selected="Mindre &lt;&lt;" name="more_less_btn" tool_tip="Avanceret opsætning"/>
+ <button label="Mere &gt;&gt;" label_selected="Mindre &lt;&lt;" name="more_btn" tool_tip="Advancerede kontroller"/>
+ <button label="Mere &gt;&gt;" label_selected="Mindre &lt;&lt;" name="less_btn" tool_tip="Advancerede kontroller"/>
</panel>
<panel name="nearby_media_panel">
- <text name="nearby_media">
- Media i nærheden
- </text>
- <text name="show">
- Vis:
- </text>
<combo_box name="show_combo">
<combo_box.item label="Overalt" name="All"/>
<combo_box.item label="På dette sted" name="WithinParcel"/>
@@ -38,7 +36,7 @@
<scroll_list.columns label="Navn" name="media_name"/>
<scroll_list.columns label="Debug" name="media_debug"/>
</scroll_list>
- <panel name="media_controls_panel">
+ <panel>
<layout_stack name="media_controls">
<layout_panel name="stop">
<button name="stop_btn" tool_tip="Stop valgte medie"/>
@@ -47,16 +45,16 @@
<button name="play_btn" tool_tip="Afspil valgte medie"/>
</layout_panel>
<layout_panel name="pause">
- <button name="pause_btn" tool_tip="Pause valgte medie"/>
+ <button name="pause_btn" tool_tip="Pause valgt medie"/>
</layout_panel>
<layout_panel name="volume_slider_ctrl">
- <slider_bar initial_value="0.5" name="volume_slider" tool_tip="Volumen for valgte medie"/>
+ <slider_bar initial_value="0.5" name="volume_slider" tool_tip="Lydstyrke for valgte medie"/>
</layout_panel>
<layout_panel name="mute">
- <button name="mute_btn" tool_tip="Sluk for lyd for valgte medie"/>
+ <button name="mute_btn" tool_tip="Sluk lyd fra valgte medie"/>
</layout_panel>
<layout_panel name="zoom">
- <button name="zoom_btn" tool_tip="Zoom ind til valgte medie"/>
+ <button name="zoom_btn" tool_tip="Zoom til valgte medie"/>
</layout_panel>
<layout_panel name="unzoom">
<button name="unzoom_btn" tool_tip="Zoom tilbage fra valgte medie"/>
diff --git a/indra/newview/skins/default/xui/da/panel_outfit_edit.xml b/indra/newview/skins/default/xui/da/panel_outfit_edit.xml
new file mode 100644
index 0000000000..de68366610
--- /dev/null
+++ b/indra/newview/skins/default/xui/da/panel_outfit_edit.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<!-- Side tray Outfit Edit panel -->
+<panel label="Redigér sæt" name="outfit_edit">
+ <string name="No Outfit" value="Intet sæt"/>
+ <panel.string name="not_available">
+ (Ikke relevant)
+ </panel.string>
+ <panel.string name="unknown">
+ (ukendt)
+ </panel.string>
+ <string name="Filter.All" value="Alle"/>
+ <string name="Filter.Clothes/Body" value="Tøj/Krop"/>
+ <string name="Filter.Objects" value="Objekter"/>
+ <button label="redigér" name="edit_wearable_btn"/>
+ <text name="title" value="Redigér sæt"/>
+ <panel label="bottom_panel" name="header_panel">
+ <panel label="bottom_panel" name="outfit_name_and_status">
+ <text name="status" value="Retter..."/>
+ <text name="curr_outfit_name" value="[Current Outfit]"/>
+ </panel>
+ </panel>
+ <layout_stack name="im_panels">
+ <layout_panel label="IM kontrolpanel" name="outfit_wearables_panel">
+ <scroll_list name="look_items_list">
+ <scroll_list.columns label="Se genstand" name="look_item"/>
+ <scroll_list.columns label="Sorter genstande i sæt" name="look_item_sort"/>
+ </scroll_list>
+ <panel label="bottom_panel" name="edit_panel"/>
+ </layout_panel>
+ <layout_panel name="add_wearables_panel">
+ <filter_editor label="Filter" name="look_item_filter"/>
+ <layout_stack name="filter_panels">
+ <layout_panel label="IM kontrolpanel" name="filter_button_panel">
+ <text name="add_to_outfit_label" value="Tilføj til sæt:"/>
+ <button label="O" name="filter_button"/>
+ </layout_panel>
+ </layout_stack>
+ <panel label="add_wearables_button_bar" name="add_wearables_button_bar">
+ <button label="F" name="folder_view_btn"/>
+ <button label="L" name="list_view_btn"/>
+ </panel>
+ </layout_panel>
+ </layout_stack>
+ <panel name="save_revert_button_bar">
+ <button label="Gem" name="save_btn"/>
+ <button label="Gendan" name="revert_btn"/>
+ </panel>
+</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/da/panel_outfits_inventory.xml
index df00cfb2eb..681701aba2 100644
--- a/indra/newview/skins/default/xui/da/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/da/panel_outfits_inventory.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<panel label="Ting" name="Outfits">
<tab_container name="appearance_tabs">
- <inventory_panel label="MINE SÆT" name="outfitslist_tab"/>
+ <panel label="MINE SÆT" name="outfitslist_tab"/>
<inventory_panel label="HAR PÅ" name="cof_tab"/>
</tab_container>
<panel name="bottom_panel">
@@ -9,6 +9,6 @@
<dnd_button name="trash_btn" tool_tip="Fjern valgte genstand"/>
<button label="Gem sæt" name="make_outfit_btn" tool_tip="Gem udseende som nyt sæt"/>
<button label="Tag på" name="wear_btn" tool_tip="Tag valgte sæt på"/>
- <button label="M" name="look_edit_btn"/>
+ <button label="Redigér sæt" name="edit_current_outfit_btn"/>
</panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_people.xml b/indra/newview/skins/default/xui/da/panel_people.xml
index 93aac7d08b..db72125b84 100644
--- a/indra/newview/skins/default/xui/da/panel_people.xml
+++ b/indra/newview/skins/default/xui/da/panel_people.xml
@@ -1,14 +1,23 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Side tray panel -->
<panel label="Personer" name="people_panel">
- <string name="no_people" value="Ingen personer"/>
- <string name="no_one_near" value="Ingen tæt på"/>
+ <string name="no_recent_people" value="Ingen tidligere personer. Leder du efter nogen at være sammen med? Prøv [secondlife:///app/search/people Search] eller [secondlife:///app/worldmap World Map]."/>
+ <string name="no_filtered_recent_people" value="Fandt du ikke hvad du ledte efter? Prøv [secondlife:///app/search/people Search]."/>
+ <string name="no_one_near" value="Ingen i nærheden. Leder du efter nogen at være sammen med? Prøv [secondlife:///app/search/people Search] eller [secondlife:///app/worldmap World Map]."/>
+ <string name="no_one_filtered_near" value="Fandt du ikke hvad du ledte efter? Prøv [secondlife:///app/search/people Search]."/>
<string name="no_friends_online" value="Ingen venner online"/>
<string name="no_friends" value="Ingen venner"/>
+ <string name="no_friends_msg">
+ Find venner via [secondlife:///app/search/people Search] eller højre-klik på en beboer og tilføj dem som venner.
+Leder du efter nogen at være sammen med? Prøv [secondlife:///app/worldmap World Map].
+ </string>
+ <string name="no_filtered_friends_msg">
+ Fandt du ikke hvad du ledte efter? Prøv [secondlife:///app/search/people Search].
+ </string>
<string name="people_filter_label" value="Filtrér personer"/>
<string name="groups_filter_label" value="Filtrér grupper"/>
- <string name="no_filtered_groups_msg" value="[secondlife:///app/search/groups Try finding the group in search?]"/>
- <string name="no_groups_msg" value="[secondlife:///app/search/groups Try searching for some groups to join.]"/>
+ <string name="no_filtered_groups_msg" value="Fandt du ikke hvad du ledte efter? Prøv [secondlife:///app/search/groups Search]."/>
+ <string name="no_groups_msg" value="Leder du efter grupper at være med i? Prøv [secondlife:///app/search/groups Search]."/>
<filter_editor label="Filtrér" name="filter_input"/>
<tab_container name="tabs">
<panel label="TÆT PÅ" name="nearby_panel">
@@ -27,10 +36,6 @@
<button name="add_btn" tool_tip="Tilbyd venskab til en beboer"/>
<button name="del_btn" tool_tip="Fjern valgte person fra din venneliste"/>
</panel>
- <text name="no_friends_msg">
- For at tilføje venner prøv [secondlife:///app/search/people global search] eller klik på en bruger for at tilføje dem som ven.
-Hvis du leder efter beboere at være sammen med, [secondlife:///app/worldmap prøv kortet].
- </text>
</panel>
<panel label="MINE GRUPPER" name="groups_panel">
<panel label="bottom_panel" name="bottom_panel">
diff --git a/indra/newview/skins/default/xui/da/panel_places.xml b/indra/newview/skins/default/xui/da/panel_places.xml
index 3ac4ebaae9..c06176f994 100644
--- a/indra/newview/skins/default/xui/da/panel_places.xml
+++ b/indra/newview/skins/default/xui/da/panel_places.xml
@@ -11,5 +11,6 @@
<button label="Gem" name="save_btn"/>
<button label="Annullér" name="cancel_btn"/>
<button label="Luk" name="close_btn"/>
+ <button label="Profil" name="profile_btn"/>
</panel>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
index 1570960745..4d505db30e 100644
--- a/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
@@ -20,6 +20,9 @@
<check_box label="Talebobler" name="bubble_text_chat"/>
<slider label="Synlighed" name="bubble_chat_opacity"/>
<color_swatch name="background" tool_tip="Vælg farve for talebobler"/>
+ <text name="UI Size:">
+ Brugerflade størrelse
+ </text>
<check_box label="Vis script fejl i:" name="show_script_errors"/>
<radio_group name="show_location">
<radio_item label="Chat" name="0"/>
@@ -29,4 +32,5 @@
<line_editor label="Brug walkie-talkie modus" name="modifier_combo"/>
<button label="Angiv taste" name="set_voice_hotkey_button"/>
<button label="Midterste museknap" name="set_voice_middlemouse_button" tool_tip="Nulstil til midterste musetaste"/>
+ <button label="Andre enheder" name="joystick_setup_button"/>
</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_world_map.xml b/indra/newview/skins/default/xui/da/panel_world_map.xml
index bea5ea6b36..138b922df1 100644
--- a/indra/newview/skins/default/xui/da/panel_world_map.xml
+++ b/indra/newview/skins/default/xui/da/panel_world_map.xml
@@ -30,6 +30,12 @@
<panel.string name="world_map_northwest">
NV
</panel.string>
+ <panel.string name="world_map_person">
+ 1 person
+ </panel.string>
+ <panel.string name="world_map_people">
+ [NUMBER] people
+ </panel.string>
<text label="N" name="floater_map_north" text="N">
N
</text>
diff --git a/indra/newview/skins/default/xui/da/sidepanel_inventory.xml b/indra/newview/skins/default/xui/da/sidepanel_inventory.xml
index ae029f5939..9a2a348f58 100644
--- a/indra/newview/skins/default/xui/da/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/da/sidepanel_inventory.xml
@@ -3,6 +3,7 @@
<panel label="" name="sidepanel__inventory_panel">
<panel name="button_panel">
<button label="Profil" name="info_btn"/>
+ <button label="Del" name="share_btn"/>
<button label="Bær" name="wear_btn"/>
<button label="Afspil" name="play_btn"/>
<button label="Teleportér" name="teleport_btn"/>
diff --git a/indra/newview/skins/default/xui/da/strings.xml b/indra/newview/skins/default/xui/da/strings.xml
index 37501a3534..bd5ab62be9 100644
--- a/indra/newview/skins/default/xui/da/strings.xml
+++ b/indra/newview/skins/default/xui/da/strings.xml
@@ -246,6 +246,9 @@
<string name="BUTTON_CLOSE_WIN">
Luk (Ctrl+W)
</string>
+ <string name="BUTTON_CLOSE_CHROME">
+ Luk
+ </string>
<string name="BUTTON_RESTORE">
Gendan
</string>
@@ -285,6 +288,9 @@
<string name="GroupNameNone">
(ingen)
</string>
+ <string name="AvalineCaller">
+ Avaline opkalder [ORDER]
+ </string>
<string name="AssetErrorNone">
Ingen fejl
</string>
@@ -880,7 +886,7 @@
Tryk ESC for at skift til normalt udsyn
</string>
<string name="InventoryNoMatchingItems">
- Ingen matchende genstande fundet i beholdning. Prøv evt. [secondlife:///app/search/groups &quot;Search&quot;].
+ Fandt du ikke hvad du ledte efter. Prøv [secondlife:///app/search/all Search].
</string>
<string name="FavoritesNoMatchingItems">
Træk et landemærke hertil for at tilføje den som favorit.
@@ -1539,9 +1545,7 @@
<string name="RegionNoCovenantOtherOwner">
Der er ingen regler for dette estate. Land på dette estate sælges af estate ejeren, ikke af Linden Lab. Kontakt venligst estate ejeren for detaljer om salg.
</string>
- <string name="covenant_last_modified">
- Sidst ændret:
- </string>
+ <string name="covenant_last_modified" value="Sidst rettet:"/>
<string name="none_text" value=" (ingen) "/>
<string name="never_text" value=" (aldrig) "/>
<string name="GroupOwned">
@@ -3218,6 +3222,15 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
<string name="LocationCtrlComboBtnTooltip">
Min lokationshistorik
</string>
+ <string name="LocationCtrlAdultIconTooltip">
+ Adult region
+ </string>
+ <string name="LocationCtrlModerateIconTooltip">
+ Moderate region
+ </string>
+ <string name="LocationCtrlGeneralIconTooltip">
+ Generel region
+ </string>
<string name="UpdaterWindowTitle">
[APP_NAME] Opdatér
</string>
@@ -3248,6 +3261,12 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
<string name="UpdaterFailStartTitle">
Opstart af klient fejlede
</string>
+ <string name="ItemsComingInTooFastFrom">
+ [APP_NAME]: Genstande modtages for hurtigt fra [FROM_NAME], automatisk visning er slået fra i [TIME] sekunder
+ </string>
+ <string name="ItemsComingInTooFast">
+ [APP_NAME]: Genstande modtages for hurtigt, automatisk visning er slået fra i [TIME] sekunder
+ </string>
<string name="IM_logging_string">
-- Logning af IM aktiveret --
</string>
@@ -3275,6 +3294,9 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
<string name="IM_moderator_label">
(Moderator)
</string>
+ <string name="answered_call">
+ Dit opkald er blevet besvaret
+ </string>
<string name="started_call">
startede et stemme opkald
</string>
@@ -3356,12 +3378,18 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
<string name="unread_chat_multiple">
[SOURCES] har sagt noget nyt
</string>
+ <string name="session_initialization_timed_out_error">
+ Initialisering af session er &quot;timed out&quot;
+ </string>
<string name="paid_you_ldollars">
[NAME] betalte dig L$[AMOUNT]
</string>
<string name="you_paid_ldollars">
Du betalte [NAME] L$[AMOUNT] [REASON].
</string>
+ <string name="you_paid_ldollars_no_info">
+ Du betalte L$[AMOUNT].
+ </string>
<string name="you_paid_ldollars_no_reason">
Du betalte [NAME] L$[AMOUNT].
</string>
@@ -3472,4 +3500,13 @@ Krænkelsesanmeldelse
<string name="Contents">
Indhold
</string>
+ <string name="AvatarBirthDateFormat">
+ [mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]
+ </string>
+ <string name="DefaultMimeType">
+ ingen/ingen
+ </string>
+ <string name="texture_load_dimensions_error">
+ Kan ikke hente billeder større end [WIDTH]*[HEIGHT]
+ </string>
</strings>
diff --git a/indra/newview/skins/default/xui/de/floater_about_land.xml b/indra/newview/skins/default/xui/de/floater_about_land.xml
index 38e72dbadf..3026ff64b2 100644
--- a/indra/newview/skins/default/xui/de/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/de/floater_about_land.xml
@@ -353,7 +353,7 @@ Nur große Parzellen können in der Suche aufgeführt werden.
<combo_box.item label="Shopping" name="item11"/>
<combo_box.item label="Sonstige" name="item12"/>
</combo_box>
- <combo_box left="266" name="land category" width="130">
+ <combo_box name="land category">
<combo_box.item label="Alle Kategorien" name="item0"/>
<combo_box.item label="Lindenort" name="item1"/>
<combo_box.item label="Kunst und Kultur" name="item3"/>
diff --git a/indra/newview/skins/default/xui/de/floater_buy_currency.xml b/indra/newview/skins/default/xui/de/floater_buy_currency.xml
index 21e3bd280f..1f79889bb7 100644
--- a/indra/newview/skins/default/xui/de/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/de/floater_buy_currency.xml
@@ -60,8 +60,7 @@
<button label="Jetzt kaufen" name="buy_btn"/>
<button label="Abbrechen" name="cancel_btn"/>
<text height="40" left="160" name="info_cannot_buy" width="200">
- Kauf nicht
-möglich
+ Kauf nicht möglich
</text>
- <button label="Weiter zum Internet" name="error_web"/>
+ <button label="Weiter zur Kontoseite" name="error_web"/>
</floater>
diff --git a/indra/newview/skins/default/xui/de/floater_color_picker.xml b/indra/newview/skins/default/xui/de/floater_color_picker.xml
index aed4bacb30..0fe154b531 100644
--- a/indra/newview/skins/default/xui/de/floater_color_picker.xml
+++ b/indra/newview/skins/default/xui/de/floater_color_picker.xml
@@ -18,7 +18,7 @@
<text name="l_val_text">
Hell.:
</text>
- <check_box label="Jetzt übernehmen" name="apply_immediate"/>
+ <check_box label="Sofort übernehmen" name="apply_immediate"/>
<button label="" label_selected="" name="color_pipette"/>
<button label="Abbrechen" label_selected="Abbrechen" name="cancel_btn"/>
<button label="OK" label_selected="OK" name="select_btn"/>
diff --git a/indra/newview/skins/default/xui/de/floater_hardware_settings.xml b/indra/newview/skins/default/xui/de/floater_hardware_settings.xml
index d01ea145f1..d931596efe 100644
--- a/indra/newview/skins/default/xui/de/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/de/floater_hardware_settings.xml
@@ -22,7 +22,7 @@
VBO aktivieren:
</text>
<check_box initial_value="true" label="OpenGL Vertex-Buffer-Objekte aktivieren" name="vbo" tool_tip="Wenn Sie über moderne Grafikhardware verfügen, können Sie durch Aktivieren dieser Option die Geschwindigkeit verbessern. Bei alter Hardware sind die VBO oft schlecht implementiert, was zu Abstürzen führen kann, wenn diese Option aktiviert ist."/>
- <slider label="Texturspeicher (MB):" name="GraphicsCardTextureMemory" tool_tip="Speicherplatz, der für Texturen zur Verfügung steht. In der Regel handelt es sich um Grafikkartenspeicher. Ein kleinerer Wert kann die Geschwindigkeit erhöhen, aber auch zu Texturunschärfen führen."/>
+ <slider label="Texturen-Cache (MB):" name="GraphicsCardTextureMemory" tool_tip="Speicherplatz, der für Texturen zur Verfügung steht. In der Regel handelt es sich um Grafikkartenspeicher. Ein kleinerer Wert kann die Geschwindigkeit erhöhen, aber auch zu Texturunschärfen führen."/>
<spinner label="Nebeldistanzverhältnis:" name="fog"/>
<button label="OK" label_selected="OK" name="OK"/>
</floater>
diff --git a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml
index aa1a93efac..bf150daf87 100644
--- a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml
@@ -52,7 +52,7 @@
<text name="requires_restart_label">
(Neustart erforderlich)
</text>
- <radio_group name="chat_window" tool_tip="Zeigen Sie Ihre Sofortnachrichten (Instant Messages) in einem anderen Fenster oder in einem einzigen Fenster mit viele Registerkarten an (Neustart erforderlich).">
+ <radio_group name="chat_window" tool_tip="Zeigen Sie Ihre Sofortnachrichten (Instant Messages) in einem anderen Fenster oder in einem einzigen Fenster mit vielen Registerkarten an (Neustart erforderlich).">
<radio_item label="Getrennte Fenster" name="radio" value="0"/>
<radio_item label="Registerkarten" name="radio2" value="1"/>
</radio_group>
diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml
index 90cdd13173..03c858c880 100644
--- a/indra/newview/skins/default/xui/de/strings.xml
+++ b/indra/newview/skins/default/xui/de/strings.xml
@@ -1561,7 +1561,7 @@
Objektinhalt
</string>
<string name="BusyModeResponseDefault">
- Der Einwohner/Die Einwohnerin ist „beschäftigt&quot;, d.h. er/sie möchte im Moment nicht gestört werden. Ihre Nachricht wird dem Einwohner/der Einwohnerin als IM angezeigt, und kann später beantwortet werden.
+ Der Einwohner/Die Einwohnerin ist „beschäftigt”, d.h. er/sie möchte im Moment nicht gestört werden. Ihre Nachricht wird dem Einwohner/der Einwohnerin als IM angezeigt, und kann später beantwortet werden.
</string>
<string name="MuteByName">
(nach Namen)
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index a6a4c79da4..b5be03346e 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -49,7 +49,7 @@ libcurl Version: [LIBCURL_VERSION]
J2C Decoder Version: [J2C_VERSION]
Audio Driver Version: [AUDIO_DRIVER_VERSION]
Qt Webkit Version: [QT_WEBKIT_VERSION]
-Vivox Version: [VIVOX_VERSION]
+Voice Server Version: [VOICE_VERSION]
</floater.string>
<floater.string
name="none">
diff --git a/indra/newview/skins/default/xui/en/floater_land_holdings.xml b/indra/newview/skins/default/xui/en/floater_land_holdings.xml
index 06c766f744..0b9ae3c9f3 100644
--- a/indra/newview/skins/default/xui/en/floater_land_holdings.xml
+++ b/indra/newview/skins/default/xui/en/floater_land_holdings.xml
@@ -99,7 +99,7 @@
name="allowed_label"
top="366"
left="10"
- width="290">
+ width="365">
Allowed land holdings at current payment plan:
</text>
<text
@@ -110,7 +110,7 @@
layout="topleft"
name="allowed_text"
top="366"
- left="305"
+ left="380"
width="290">
[AREA] m²
</text>
@@ -123,7 +123,7 @@
top="386"
left="10"
name="current_label"
- width="290">
+ width="365">
Current land holdings:
</text>
<text
@@ -133,7 +133,7 @@
height="16"
layout="topleft"
top="386"
- left="305"
+ left="380"
name="current_text"
width="290">
[AREA] m²
@@ -148,7 +148,7 @@
top="406"
left="10"
name="available_label"
- width="290">
+ width="365">
Available for land purchases:
</text>
<text
@@ -160,7 +160,7 @@
layout="topleft"
name="available_text"
top="406"
- left="305"
+ left="380"
width="290">
[AREA] m²
</text>
diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml
index 8e2c57764b..a685094190 100644
--- a/indra/newview/skins/default/xui/en/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/en/floater_moveview.xml
@@ -13,7 +13,7 @@
save_rect="true"
save_visibility="true"
save_dock_state="true"
- width="115">
+ width="113">
<string
name="walk_forward_tooltip">
Walk Forward (press Up Arrow or W)
@@ -23,6 +23,14 @@
Walk Backwards (press Down Arrow or S)
</string>
<string
+ name="walk_left_tooltip">
+ Walk left (press Shift + Left Arrow or A)
+ </string>
+ <string
+ name="walk_right_tooltip">
+ Walk right (press Shift + Right Arrow or D)
+ </string>
+ <string
name="run_forward_tooltip">
Run Forward (press Up Arrow or W)
</string>
@@ -31,6 +39,14 @@
Run Backwards (press Down Arrow or S)
</string>
<string
+ name="run_left_tooltip">
+ Run left (press Shift + Left Arrow or A)
+ </string>
+ <string
+ name="run_right_tooltip">
+ Run right (press Shift + Right Arrow or D)
+ </string>
+ <string
name="fly_forward_tooltip">
Fly Forward (press Up Arrow or W)
</string>
@@ -39,6 +55,30 @@
Fly Backwards (press Down Arrow or S)
</string>
<string
+ name="fly_left_tooltip">
+ Fly left (press Shift + Left Arrow or A)
+ </string>
+ <string
+ name="fly_right_tooltip">
+ Fly right (press Shift + Right Arrow or D)
+ </string>
+ <string
+ name="fly_up_tooltip">
+ Fly up (press E)
+ </string>
+ <string
+ name="fly_down_tooltip">
+ Fly down (press C)
+ </string>
+ <string
+ name="jump_tooltip">
+ Jump (press E)
+ </string>
+ <string
+ name="crouch_tooltip">
+ Crouch (press C)
+ </string>
+ <string
name="walk_title">
Walk
</string>
@@ -59,59 +99,91 @@
mouse_opaque="false"
name="panel_actions"
top="0"
- width="115">
+ width="113">
+ <!-- Buttons in panel are organized in 3 columns to enable their easy vertical adjustment via top_pad-->
+ <!-- Left column -->
<button
follows="left|bottom"
- height="25"
+ height="24"
+ image_selected="Movement_Up_On"
+ image_pressed_selected="Movement_Up_On"
+ image_unselected="Movement_Up_Off"
+ layout="topleft"
+ left="23"
+ name="move up btn"
+ scale_image="false"
+ tool_tip="Fly up (press E)"
+ top="18"
+ width="24" />
+ <button
+ follows="left|bottom"
+ height="24"
image_selected="Movement_TurnLeft_On"
image_pressed_selected="Movement_TurnLeft_On"
image_unselected="Movement_TurnLeft_Off"
layout="topleft"
- left="17"
+ left="15"
name="turn left btn"
scale_image="false"
tool_tip="Turn left (press Left Arrow or A)"
- top="45"
- width="25" />
- <button
- follows="left|bottom"
- height="25"
- image_selected="Movement_TurnRight_On"
- image_pressed_selected="Movement_TurnRight_On"
- image_unselected="Movement_TurnRight_Off"
- layout="topleft"
- left_pad="34"
- name="turn right btn"
- scale_image="false"
- tool_tip="Turn right (press Right Arrow or D)"
- top_delta="0"
- width="25" />
- <button
+ top_pad="-3"
+ width="24" />
+ <joystick_slide
follows="left|bottom"
- height="25"
- image_selected="Movement_Up_On"
- image_pressed_selected="Movement_Up_On"
- image_unselected="Movement_Up_Off"
+ height="24"
+ image_selected="Movement_Left_On"
+ image_pressed_selected="Movement_Left_On"
+ image_unselected="Movement_Left_Off"
layout="topleft"
- left="10"
- name="move up btn"
+ left="18"
+ name="move left btn"
+ quadrant="left"
scale_image="false"
- tool_tip="Fly up, press E"
- top="14"
- width="25" />
+ tool_tip="Walk left (press Shift + Left Arrow or A)"
+ top_pad="-3"
+ width="24" />
+ <!-- Right column -->
<button
follows="left|bottom"
- height="25"
+ height="24"
image_selected="Movement_Down_On"
image_pressed_selected="Movement_Down_On"
image_unselected="Movement_Down_Off"
layout="topleft"
- left_pad="45"
+ right="-21"
name="move down btn"
scale_image="false"
- tool_tip="Fly down, press C"
- top_delta="0"
- width="20" />
+ tool_tip="Fly down (press C)"
+ top="18"
+ width="24" />
+ <button
+ follows="left|bottom"
+ height="24"
+ image_selected="Movement_TurnRight_On"
+ image_pressed_selected="Movement_TurnRight_On"
+ image_unselected="Movement_TurnRight_Off"
+ layout="topleft"
+ right="-13"
+ name="turn right btn"
+ scale_image="false"
+ tool_tip="Turn left (press Right Arrow or D)"
+ top_pad="-3"
+ width="24" />
+ <joystick_slide
+ follows="left|bottom"
+ height="24"
+ image_selected="Movement_Right_On"
+ image_pressed_selected="Movement_Right_On"
+ image_unselected="Movement_Right_Off"
+ layout="topleft"
+ name="move right btn"
+ quadrant="right"
+ right="-16"
+ scale_image="false"
+ tool_tip="Walk right (press Shift + Right Arrow or D)"
+ top_pad="-3"
+ width="24" />
+ <!-- Middle column -->
<joystick_turn
follows="left|bottom"
height="25"
@@ -124,7 +196,7 @@
quadrant="up"
scale_image="false"
tool_tip="Walk forward (press up arrow or W)"
- top_delta="10"
+ top="22"
width="21" />
<joystick_turn
follows="left|bottom"
@@ -138,7 +210,7 @@
quadrant="down"
scale_image="false"
tool_tip="Walk backward (press down arrow or S)"
- top_delta="30"
+ top_pad="7"
width="21" />
</panel>
<!-- Width and height of this panel should be synchronized with panel_stand_stop_flying.xml -->
@@ -149,7 +221,7 @@
left="0"
name="panel_modes"
top_pad="0"
- width="115">
+ width="113">
<button
follows="left|bottom"
height="23"
diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
index b2e4a7ad95..e42b88abc3 100644
--- a/indra/newview/skins/default/xui/en/main_view.xml
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -50,7 +50,7 @@
name="non_side_tray_view"
user_resize="false"
width="500">
- <view bottom="500"
+ <world_view bottom="500"
follows="all"
height="500"
left="0"
diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml
index e95300a4b3..9fac296e26 100644
--- a/indra/newview/skins/default/xui/en/menu_login.xml
+++ b/indra/newview/skins/default/xui/en/menu_login.xml
@@ -22,7 +22,7 @@
</menu_item_call>
<menu_item_separator />
<menu_item_call
- label="Quit [APP_NAME]"
+ label="Exit [APP_NAME]"
name="Quit"
shortcut="control|Q">
<menu_item_call.on_click
diff --git a/indra/newview/skins/default/xui/en/menu_participant_list.xml b/indra/newview/skins/default/xui/en/menu_participant_list.xml
index 2515b60868..f126431263 100644
--- a/indra/newview/skins/default/xui/en/menu_participant_list.xml
+++ b/indra/newview/skins/default/xui/en/menu_participant_list.xml
@@ -6,31 +6,31 @@
label="Sort by Name"
layout="topleft"
name="SortByName">
- <menu_item_check.on_click
- function="ParticipantList.Sort"
- parameter="sort_by_name" />
- <menu_item_check.on_check
+ <on_check
function="ParticipantList.CheckItem"
parameter="is_sorted_by_name" />
+ <on_click
+ function="ParticipantList.Sort"
+ parameter="sort_by_name" />
</menu_item_check>
<menu_item_check
label="Sort by Recent Speakers"
layout="topleft"
name="SortByRecentSpeakers">
- <menu_item_check.on_click
- function="ParticipantList.Sort"
- parameter="sort_by_recent_speakers" />
- <menu_item_check.on_check
+ <on_check
function="ParticipantList.CheckItem"
parameter="is_sorted_by_recent_speakers" />
+ <on_click
+ function="ParticipantList.Sort"
+ parameter="sort_by_recent_speakers" />
</menu_item_check>
<menu_item_call
label="View Profile"
layout="topleft"
name="View Profile">
- <menu_item_call.on_click
+ <on_click
function="Avatar.Profile" />
- <menu_item_call.on_enable
+ <on_enable
function="ParticipantList.EnableItem"
parameter="can_view_profile" />
</menu_item_call>
@@ -38,9 +38,9 @@
label="Add Friend"
layout="topleft"
name="Add Friend">
- <menu_item_call.on_click
+ <on_click
function="Avatar.AddFriend" />
- <menu_item_call.on_enable
+ <on_enable
function="ParticipantList.EnableItem"
parameter="can_add" />
</menu_item_call>
@@ -48,9 +48,9 @@
label="IM"
layout="topleft"
name="IM">
- <menu_item_call.on_click
+ <on_click
function="Avatar.IM" />
- <menu_item_call.on_enable
+ <on_enable
function="ParticipantList.EnableItem"
parameter="can_im" />
</menu_item_call>
@@ -58,20 +58,19 @@
label="Call"
layout="topleft"
name="Call">
- <menu_item_call.on_click
+ <on_click
function="Avatar.Call" />
- <menu_item_call.on_enable
+ <on_enable
function="ParticipantList.EnableItem"
parameter="can_call" />
</menu_item_call>
<menu_item_call
- enabled="true"
label="Share"
layout="topleft"
name="Share">
- <menu_item_call.on_click
+ <on_click
function="Avatar.Share" />
- <menu_item_call.on_enable
+ <on_enable
function="ParticipantList.EnableItem"
parameter="can_share" />
</menu_item_call>
@@ -79,37 +78,38 @@
label="Pay"
layout="topleft"
name="Pay">
- <menu_item_call.on_click
+ <on_click
function="Avatar.Pay" />
- <menu_item_call.on_enable
+ <on_enable
function="ParticipantList.EnableItem"
parameter="can_pay" />
</menu_item_call>
<menu_item_separator
- layout="topleft"
- name="View Icons Separator" />
+ layout="topleft"
+ name="View Icons Separator" />
<menu_item_check
- label="View People Icons"
- name="View Icons">
- <on_click
- function="ToggleControl"
- parameter="ParticipantListShowIcons"/>
- <on_check
- function="CheckControl"
- parameter="ParticipantListShowIcons" />
+ label="View People Icons"
+ layout="topleft"
+ name="View Icons">
+ <on_check
+ function="CheckControl"
+ parameter="ParticipantListShowIcons" />
+ <on_click
+ function="ToggleControl"
+ parameter="ParticipantListShowIcons" />
</menu_item_check>
<menu_item_separator
- layout="topleft" />
+ layout="topleft" />
<menu_item_check
label="Block Voice"
layout="topleft"
name="Block/Unblock">
- <menu_item_check.on_click
- function="Avatar.BlockUnblock" />
- <menu_item_check.on_check
+ <on_check
function="ParticipantList.CheckItem"
parameter="is_blocked" />
- <menu_item_check.on_enable
+ <on_click
+ function="Avatar.BlockUnblock" />
+ <on_enable
function="ParticipantList.EnableItem"
parameter="can_block" />
</menu_item_check>
@@ -126,71 +126,71 @@
function="ParticipantList.EnableItem"
parameter="can_mute_text" />
</menu_item_check>
- <menu_item_separator
- layout="topleft" />
+ <menu_item_separator
+ layout="topleft" />
<context_menu
label="Moderator Options &gt;"
layout="topleft"
- name="Moderator Options" >
- <menu_item_check
- label="Allow text chat"
- layout="topleft"
- name="AllowTextChat">
- <on_check
- function="ParticipantList.CheckItem"
- parameter="is_allowed_text_chat" />
- <on_click
- function="ParticipantList.ToggleAllowTextChat" />
- <on_enable
- function="ParticipantList.EnableItem"
- parameter="can_allow_text_chat" />
- </menu_item_check>
- <menu_item_separator
- layout="topleft"
- name="moderate_voice_separator" />
- <menu_item_call
- label="Mute this participant"
- layout="topleft"
- name="ModerateVoiceMuteSelected">
- <on_click
- function="ParticipantList.ModerateVoice"
- parameter="selected" />
- <on_enable
- function="ParticipantList.EnableItem.Moderate"
- parameter="can_moderate_voice" />
- </menu_item_call>
- <menu_item_call
- label="Mute everyone else"
- layout="topleft"
- name="ModerateVoiceMuteOthers">
- <on_click
- function="ParticipantList.ModerateVoice"
- parameter="others" />
- <on_enable
- function="ParticipantList.EnableItem.Moderate"
- parameter="can_moderate_voice" />
- </menu_item_call>
- <menu_item_call
- label="Unmute this participant"
- layout="topleft"
- name="ModerateVoiceUnMuteSelected">
- <on_click
- function="ParticipantList.ModerateVoice"
- parameter="selected" />
- <on_enable
- function="ParticipantList.EnableItem.Moderate"
- parameter="can_moderate_voice" />
- </menu_item_call>
- <menu_item_call
- label="Unmute everyone else"
- layout="topleft"
- name="ModerateVoiceUnMuteOthers">
- <on_click
- function="ParticipantList.ModerateVoice"
- parameter="others" />
- <on_enable
- function="ParticipantList.EnableItem.Moderate"
- parameter="can_moderate_voice" />
- </menu_item_call>
+ name="Moderator Options">
+ <menu_item_check
+ label="Allow text chat"
+ layout="topleft"
+ name="AllowTextChat">
+ <on_check
+ function="ParticipantList.CheckItem"
+ parameter="is_allowed_text_chat" />
+ <on_click
+ function="ParticipantList.ToggleAllowTextChat" />
+ <on_enable
+ function="ParticipantList.EnableItem"
+ parameter="can_allow_text_chat" />
+ </menu_item_check>
+ <menu_item_separator
+ layout="topleft"
+ name="moderate_voice_separator" />
+ <menu_item_call
+ label="Mute this participant"
+ layout="topleft"
+ name="ModerateVoiceMuteSelected">
+ <on_click
+ function="ParticipantList.ModerateVoice"
+ parameter="selected" />
+ <on_enable
+ function="ParticipantList.EnableItem.Moderate"
+ parameter="can_moderate_voice" />
+ </menu_item_call>
+ <menu_item_call
+ label="Unmute this participant"
+ layout="topleft"
+ name="ModerateVoiceUnMuteSelected">
+ <on_click
+ function="ParticipantList.ModerateVoice"
+ parameter="selected" />
+ <on_enable
+ function="ParticipantList.EnableItem.Moderate"
+ parameter="can_moderate_voice" />
+ </menu_item_call>
+ <menu_item_call
+ label="Mute everyone"
+ layout="topleft"
+ name="ModerateVoiceMute">
+ <on_click
+ function="ParticipantList.ModerateVoice"
+ parameter="mute_all" />
+ <on_enable
+ function="ParticipantList.EnableItem.Moderate"
+ parameter="can_moderate_voice" />
+ </menu_item_call>
+ <menu_item_call
+ label="Unmute everyone"
+ layout="topleft"
+ name="ModerateVoiceUnmute">
+ <on_click
+ function="ParticipantList.ModerateVoice"
+ parameter="unmute_all" />
+ <on_enable
+ function="ParticipantList.EnableItem.Moderate"
+ parameter="can_moderate_voice" />
+ </menu_item_call>
</context_menu>
</context_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index eefcabdd39..c9ebeb60fb 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -90,7 +90,6 @@
<menu_item_call.on_click
function="World.SetAway" />
</menu_item_call>
- <menu_item_separator/>
<menu_item_call
label="Busy"
name="Set Busy">
@@ -116,7 +115,7 @@
</menu_item_call>
<menu_item_separator/>
<menu_item_call
- label="Quit [APP_NAME]"
+ label="Exit [APP_NAME]"
name="Quit"
shortcut="control|Q">
<menu_item_call.on_click
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 4479a3dd4d..a2acb8100f 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -735,6 +735,14 @@ You need an account to enter [SECOND_LIFE]. Would you like to create one now?
<notification
icon="alertmodal.tga"
+ name="InvalidCredentialFormat"
+ type="alertmodal">
+You need to enter both the First and Last name of your avatar into the Username field, then login again.
+ </notification>
+
+
+ <notification
+ icon="alertmodal.tga"
name="AddClassified"
type="alertmodal">
Classified ads appear in the &apos;Classified&apos; section of the Search directory and on [http://secondlife.com/community/classifieds secondlife.com] for one week.
@@ -1199,6 +1207,7 @@ Eject [AVATAR_NAME] from your land?
<notification
icon="alertmodal.tga"
name="EjectAvatarFromGroup"
+ persist="true"
type="notify">
You ejected [AVATAR_NAME] from group [GROUP_NAME]
</notification>
@@ -1384,6 +1393,18 @@ Unable to encode file: [FILE]
<notification
icon="alertmodal.tga"
+ name="CorruptedProtectedDataStore"
+ type="alertmodal">
+ We are unable to read your protected data so it is being reset.
+ This may happen when you change network setup.
+
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="CorruptResourceFile"
type="alertmodal">
Corrupt resource file: [FILE]
@@ -2124,6 +2145,19 @@ Please enter a higher price.
<notification
icon="alertmodal.tga"
+ name="ConfirmItemDeleteHasLinks"
+ type="alertmodal">
+At least one of the items you has link items that point to it. If you delete this item, its links will permanently stop working. It is strongly advised to delete the links first.
+
+Are you sure you want to delete these items?
+ <usetemplate
+ name="okcancelbuttons"
+ notext="Cancel"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="ConfirmObjectDeleteLock"
type="alertmodal">
At least one of the items you have selected is locked.
@@ -2417,6 +2451,57 @@ Please choose the male or female avatar. You can change your mind later.
notext="Female"
yestext="Male"/>
</notification>
+ <notification icon="alertmodal.tga"
+ name="CantTeleportToGrid"
+ type="alertmodal">
+Could not teleport to [SLURL] as it's on a different grid ([GRID]) than the current grid ([CURRENT_GRID]). Please close your viewer and try again.
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification icon="alertmodal.tga"
+ name="GeneralCertificateError"
+ type="alertmodal">
+Could not connect to the server.
+[REASON]
+
+SubjectName: [SUBJECT_NAME_STRING]
+IssuerName: [ISSUER_NAME_STRING]
+Valid From: [VALID_FROM]
+Valid To: [VALID_TO]
+MD5 Fingerprint: [SHA1_DIGEST]
+SHA1 Fingerprint: [MD5_DIGEST]
+Key Usage: [KEYUSAGE]
+Extended Key Usage: [EXTENDEDKEYUSAGE]
+Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification icon="alertmodal.tga"
+ name="TrustCertificateError"
+ type="alertmodal">
+The certification authority for this server is not known.
+
+Certificate Information:
+SubjectName: [SUBJECT_NAME_STRING]
+IssuerName: [ISSUER_NAME_STRING]
+Valid From: [VALID_FROM]
+Valid To: [VALID_TO]
+MD5 Fingerprint: [SHA1_DIGEST]
+SHA1 Fingerprint: [MD5_DIGEST]
+Key Usage: [KEYUSAGE]
+Extended Key Usage: [EXTENDEDKEYUSAGE]
+Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
+
+Would you like to trust this authority?
+ <usetemplate
+ name="okcancelbuttons"
+ notext="Cancel"
+ yestext="Trust"/>
+ </notification>
<notification
icon="alertmodal.tga"
@@ -2428,6 +2513,7 @@ Please choose the male or female avatar. You can change your mind later.
<notification
icon="alertmodal.tga"
name="GrantedModifyRights"
+ persist="true"
type="notify">
[NAME] has given you permission to edit their objects.
</notification>
@@ -2435,6 +2521,7 @@ Please choose the male or female avatar. You can change your mind later.
<notification
icon="alertmodal.tga"
name="RevokedModifyRights"
+ persist="true"
type="notify">
Your privilege to modify [NAME]&apos;s objects has been revoked
</notification>
@@ -3364,7 +3451,7 @@ You are not allowed in that region due to your maturity Rating.
type="alertmodal">
You are not allowed in that Region due to your maturity Rating preference.
-You can click &apos;Change Preference&apos; to raise your maturity Rating preference now and allow you to enter. You will be able to search and access [REGIONMATURITY] content from now on. If you later want to change this setting back, go to Me &gt; Preferences &gt; General.
+Click &apos;Change Preference&apos; to raise your maturity Rating preference for immediate entry. Doing so will allow you to search for and access [REGIONMATURITY] content. If you wish to change this setting later, you may do so from Me &gt; Preferences &gt; General.
<form name="form">
<button
index="0"
@@ -3383,7 +3470,7 @@ You can click &apos;Change Preference&apos; to raise your maturity Rating prefer
icon="notifytip.tga"
name="PreferredMaturityChanged"
type="notifytip">
-Your maturity rating preference is now [RATING].
+Your maturity Rating preference is now [RATING].
</notification>
<notification
@@ -4349,6 +4436,7 @@ Replaced missing clothing/body part with default.
<notification
icon="groupnotify"
name="GroupNotice"
+ persist="true"
type="groupnotify">
Topic: [SUBJECT], Message: [MESSAGE]
</notification>
@@ -4397,6 +4485,7 @@ Do you wish to proceed?
<notification
icon="notify.tga"
name="UploadPayment"
+ persist="true"
type="notify">
You paid L$[AMOUNT] to upload.
</notification>
@@ -4684,6 +4773,7 @@ Please select at least one type of content to search (General, Moderate, or Adul
<notification
icon="notify.tga"
name="SystemMessage"
+ persist="true"
type="notify">
[MESSAGE]
</notification>
@@ -4691,10 +4781,13 @@ Please select at least one type of content to search (General, Moderate, or Adul
<notification
icon="notify.tga"
name="PaymentRecived"
+ persist="true"
type="notify">
[MESSAGE]
</notification>
+ <!-- EventNotification couldn't be persist since server decide is it necessary to notify
+ user about subscribed event via LLEventNotifier-->
<notification
icon="notify.tga"
name="EventNotification"
@@ -4722,6 +4815,7 @@ Event Notification:
<notification
icon="notify.tga"
name="TransferObjectsHighlighted"
+ persist="true"
type="notify">
All objects on this parcel that will transfer to the purchaser of this parcel are now highlighted.
@@ -4737,6 +4831,7 @@ All objects on this parcel that will transfer to the purchaser of this parcel ar
<notification
icon="notify.tga"
name="DeactivatedGesturesTrigger"
+ persist="true"
type="notify">
Deactivated gestures with same trigger:
[NAMES]
@@ -4745,6 +4840,7 @@ Deactivated gestures with same trigger:
<notification
icon="notify.tga"
name="NoQuickTime"
+ persist="true"
type="notify">
Apple&apos;s QuickTime software does not appear to be installed on your system.
If you want to view streaming media on parcels that support it you should go to the [http://www.apple.com/quicktime QuickTime site] and install the QuickTime Player.
@@ -4752,6 +4848,7 @@ If you want to view streaming media on parcels that support it you should go to
<notification
icon="notify.tga"
name="NoPlugin"
+ persist="true"
type="notify">
No Media Plugin was found to handle the "[MIME_TYPE]" mime type. Media of this type will be unavailable.
</notification>
@@ -4771,6 +4868,7 @@ Please re-install the plugin or contact the vendor if you continue to experience
<notification
icon="notify.tga"
name="OwnedObjectsReturned"
+ persist="true"
type="notify">
The objects you own on the selected parcel of land have been returned back to your inventory.
</notification>
@@ -4778,6 +4876,7 @@ The objects you own on the selected parcel of land have been returned back to yo
<notification
icon="notify.tga"
name="OtherObjectsReturned"
+ persist="true"
type="notify">
The objects on the selected parcel of land that is owned by [FIRST] [LAST] have been returned to his or her inventory.
</notification>
@@ -4785,6 +4884,7 @@ The objects on the selected parcel of land that is owned by [FIRST] [LAST] have
<notification
icon="notify.tga"
name="OtherObjectsReturned2"
+ persist="true"
type="notify">
The objects on the selected parcel of land owned by the Resident &apos;[NAME]&apos; have been returned to their owner.
</notification>
@@ -4792,6 +4892,7 @@ The objects on the selected parcel of land owned by the Resident &apos;[NAME]&ap
<notification
icon="notify.tga"
name="GroupObjectsReturned"
+ persist="true"
type="notify">
The objects on the selected parcel of land shared with the group [GROUPNAME] have been returned back to their owner&apos;s inventory.
Transferable deeded objects have been returned to their previous owners.
@@ -4801,6 +4902,7 @@ Non-transferable objects that are deeded to the group have been deleted.
<notification
icon="notify.tga"
name="UnOwnedObjectsReturned"
+ persist="true"
type="notify">
The objects on the selected parcel that are NOT owned by you have been returned to their owners.
</notification>
@@ -4808,6 +4910,7 @@ The objects on the selected parcel that are NOT owned by you have been returned
<notification
icon="notify.tga"
name="ServerObjectMessage"
+ persist="true"
type="notify">
Message from [NAME]:
&lt;nolink&gt;[MSG]&lt;/nolink&gt;
@@ -4816,6 +4919,7 @@ Message from [NAME]:
<notification
icon="notify.tga"
name="NotSafe"
+ persist="true"
type="notify">
This land has damage enabled.
You can be hurt here. If you die, you will be teleported to your home location.
@@ -4825,6 +4929,7 @@ You can be hurt here. If you die, you will be teleported to your home location.
<notification
icon="notify.tga"
name="NoFly"
+ persist="true"
type="notify">
This area has flying disabled.
You can&apos;t fly here.
@@ -4834,6 +4939,7 @@ You can&apos;t fly here.
<notification
icon="notify.tga"
name="PushRestricted"
+ persist="true"
type="notify">
This area does not allow pushing. You can&apos;t push others here unless you own the land.
<unique/>
@@ -4842,6 +4948,7 @@ This area does not allow pushing. You can&apos;t push others here unless you own
<notification
icon="notify.tga"
name="NoVoice"
+ persist="true"
type="notify">
This area has voice chat disabled. You won&apos;t be able to hear anyone talking.
<unique/>
@@ -4850,6 +4957,7 @@ This area has voice chat disabled. You won&apos;t be able to hear anyone talking
<notification
icon="notify.tga"
name="NoBuild"
+ persist="true"
type="notify">
This area has building disabled. You can&apos;t build or rez objects here.
<unique/>
@@ -4858,6 +4966,7 @@ This area has building disabled. You can&apos;t build or rez objects here.
<notification
icon="notify.tga"
name="ScriptsStopped"
+ persist="true"
type="notify">
An administrator has temporarily stopped scripts in this region.
</notification>
@@ -4865,6 +4974,7 @@ An administrator has temporarily stopped scripts in this region.
<notification
icon="notify.tga"
name="ScriptsNotRunning"
+ persist="true"
type="notify">
This region is not running any scripts.
</notification>
@@ -4872,6 +4982,7 @@ This region is not running any scripts.
<notification
icon="notify.tga"
name="NoOutsideScripts"
+ persist="true"
type="notify">
This land has outside scripts disabled.
@@ -4881,6 +4992,7 @@ No scripts will work here except those belonging to the land owner.
<notification
icon="notify.tga"
name="ClaimPublicLand"
+ persist="true"
type="notify">
You can only claim public land in the Region you&apos;re in.
</notification>
@@ -4888,6 +5000,7 @@ You can only claim public land in the Region you&apos;re in.
<notification
icon="notify.tga"
name="RegionTPAccessBlocked"
+ persist="true"
type="notify">
You aren&apos;t allowed in that Region due to your maturity Rating. You may need to validate your age and/or install the latest Viewer.
@@ -4897,6 +5010,7 @@ Please go to the Knowledge Base for details on accessing areas with this maturit
<notification
icon="notify.tga"
name="URBannedFromRegion"
+ persist="true"
type="notify">
You are banned from the region.
</notification>
@@ -4904,6 +5018,7 @@ You are banned from the region.
<notification
icon="notify.tga"
name="NoTeenGridAccess"
+ persist="true"
type="notify">
Your account cannot connect to this teen grid region.
</notification>
@@ -4911,6 +5026,7 @@ Your account cannot connect to this teen grid region.
<notification
icon="notify.tga"
name="ImproperPaymentStatus"
+ persist="true"
type="notify">
You do not have proper payment status to enter this region.
</notification>
@@ -4918,6 +5034,7 @@ You do not have proper payment status to enter this region.
<notification
icon="notify.tga"
name="MustGetAgeRgion"
+ persist="true"
type="notify">
You must be age-verified to enter this region.
</notification>
@@ -4925,6 +5042,7 @@ You must be age-verified to enter this region.
<notification
icon="notify.tga"
name="MustGetAgeParcel"
+ persist="true"
type="notify">
You must be age-verified to enter this parcel.
</notification>
@@ -4932,6 +5050,7 @@ You must be age-verified to enter this parcel.
<notification
icon="notify.tga"
name="NoDestRegion"
+ persist="true"
type="notify">
No destination region found.
</notification>
@@ -4939,6 +5058,7 @@ No destination region found.
<notification
icon="notify.tga"
name="NotAllowedInDest"
+ persist="true"
type="notify">
You are not allowed into the destination.
</notification>
@@ -4946,6 +5066,7 @@ You are not allowed into the destination.
<notification
icon="notify.tga"
name="RegionParcelBan"
+ persist="true"
type="notify">
Cannot region cross into banned parcel. Try another way.
</notification>
@@ -4953,6 +5074,7 @@ Cannot region cross into banned parcel. Try another way.
<notification
icon="notify.tga"
name="TelehubRedirect"
+ persist="true"
type="notify">
You have been redirected to a telehub.
</notification>
@@ -4960,6 +5082,7 @@ You have been redirected to a telehub.
<notification
icon="notify.tga"
name="CouldntTPCloser"
+ persist="true"
type="notify">
Could not teleport closer to destination.
</notification>
@@ -4967,6 +5090,7 @@ Could not teleport closer to destination.
<notification
icon="notify.tga"
name="TPCancelled"
+ persist="true"
type="notify">
Teleport cancelled.
</notification>
@@ -4974,6 +5098,7 @@ Teleport cancelled.
<notification
icon="notify.tga"
name="FullRegionTryAgain"
+ persist="true"
type="notify">
The region you are attempting to enter is currently full.
Please try again in a few moments.
@@ -4982,6 +5107,7 @@ Please try again in a few moments.
<notification
icon="notify.tga"
name="GeneralFailure"
+ persist="true"
type="notify">
General failure.
</notification>
@@ -4989,6 +5115,7 @@ General failure.
<notification
icon="notify.tga"
name="RoutedWrongRegion"
+ persist="true"
type="notify">
Routed to wrong region. Please try again.
</notification>
@@ -4996,6 +5123,7 @@ Routed to wrong region. Please try again.
<notification
icon="notify.tga"
name="NoValidAgentID"
+ persist="true"
type="notify">
No valid agent id.
</notification>
@@ -5003,6 +5131,7 @@ No valid agent id.
<notification
icon="notify.tga"
name="NoValidSession"
+ persist="true"
type="notify">
No valid session id.
</notification>
@@ -5010,6 +5139,7 @@ No valid session id.
<notification
icon="notify.tga"
name="NoValidCircuit"
+ persist="true"
type="notify">
No valid circuit code.
</notification>
@@ -5017,6 +5147,7 @@ No valid circuit code.
<notification
icon="notify.tga"
name="NoValidTimestamp"
+ persist="true"
type="notify">
No valid timestamp.
</notification>
@@ -5024,6 +5155,7 @@ No valid timestamp.
<notification
icon="notify.tga"
name="NoPendingConnection"
+ persist="true"
type="notify">
Unable to create pending connection.
</notification>
@@ -5031,6 +5163,7 @@ Unable to create pending connection.
<notification
icon="notify.tga"
name="InternalUsherError"
+ persist="true"
type="notify">
Internal error attempting to connect agent usher.
</notification>
@@ -5038,6 +5171,7 @@ Internal error attempting to connect agent usher.
<notification
icon="notify.tga"
name="NoGoodTPDestination"
+ persist="true"
type="notify">
Unable to find a good teleport destination in this region.
</notification>
@@ -5045,6 +5179,7 @@ Unable to find a good teleport destination in this region.
<notification
icon="notify.tga"
name="InternalErrorRegionResolver"
+ persist="true"
type="notify">
Internal error attempting to activate region resolver.
</notification>
@@ -5052,6 +5187,7 @@ Internal error attempting to activate region resolver.
<notification
icon="notify.tga"
name="NoValidLanding"
+ persist="true"
type="notify">
A valid landing point could not be found.
</notification>
@@ -5059,6 +5195,7 @@ A valid landing point could not be found.
<notification
icon="notify.tga"
name="NoValidParcel"
+ persist="true"
type="notify">
No valid parcel could be found.
</notification>
@@ -5066,7 +5203,6 @@ No valid parcel could be found.
<notification
icon="notify.tga"
name="ObjectGiveItem"
- persist="true"
type="offer">
An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJECTTYPE]:
[ITEM_SLURL]
@@ -5088,30 +5224,7 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
<notification
icon="notify.tga"
- name="ObjectGiveItemUnknownUser"
- type="offer">
-An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you this [OBJECTTYPE]:
-[ITEM_SLURL]
- <form name="form">
- <button
- index="0"
- name="Keep"
- text="Keep"/>
- <button
- index="1"
- name="Discard"
- text="Discard"/>
- <button
- index="2"
- name="Mute"
- text="Block"/>
- </form>
- </notification>
-
- <notification
- icon="notify.tga"
name="UserGiveItem"
- persist="true"
type="offer">
[NAME_SLURL] has given you this [OBJECTTYPE]:
[ITEM_SLURL]
@@ -5134,6 +5247,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="GodMessage"
+ persist="true"
type="notify">
[NAME]
@@ -5143,6 +5257,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="JoinGroup"
+ persist="true"
type="notify">
[MESSAGE]
<form name="form">
@@ -5164,7 +5279,6 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="TeleportOffered"
- persist="true"
type="offer">
[NAME_SLURL] has offered to teleport you to their location:
@@ -5192,6 +5306,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="GotoURL"
+ persist="true"
type="notify">
[MESSAGE]
[URL]
@@ -5210,7 +5325,6 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="OfferFriendship"
- persist="true"
type="offer">
[NAME_SLURL] is offering friendship.
@@ -5239,6 +5353,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="OfferFriendshipNoMessage"
+ persist="true"
type="notify">
[NAME] is offering friendship.
@@ -5265,6 +5380,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="FriendshipDeclined"
+ persist="true"
type="notify">
[NAME] declined your friendship offer.
</notification>
@@ -5286,6 +5402,7 @@ Friendship offer declined.
<notification
icon="notify.tga"
name="OfferCallingCard"
+ persist="true"
type="notify">
[FIRST] [LAST] is offering their calling card.
This will add a bookmark in your inventory so you can quickly IM this Resident.
@@ -5306,6 +5423,7 @@ This will add a bookmark in your inventory so you can quickly IM this Resident.
name="RegionRestartMinutes"
priority="high"
sound="UISndAlert"
+ persist="true"
type="notify">
This region will restart in [MINUTES] minutes.
If you stay in this region you will be logged out.
@@ -5316,6 +5434,7 @@ If you stay in this region you will be logged out.
name="RegionRestartSeconds"
priority="high"
sound="UISndAlert"
+ persist="true"
type="notify">
This region will restart in [SECONDS] seconds.
If you stay in this region you will be logged out.
@@ -5324,6 +5443,7 @@ If you stay in this region you will be logged out.
<notification
icon="notify.tga"
name="LoadWebPage"
+ persist="true"
type="notify">
Load web page [URL]?
@@ -5345,6 +5465,7 @@ From object: [OBJECTNAME], owner: [NAME]?
<notification
icon="notify.tga"
name="FailedToFindWearableUnnamed"
+ persist="true"
type="notify">
Failed to find [TYPE] in database.
</notification>
@@ -5352,6 +5473,7 @@ Failed to find [TYPE] in database.
<notification
icon="notify.tga"
name="FailedToFindWearable"
+ persist="true"
type="notify">
Failed to find [TYPE] named [DESC] in database.
</notification>
@@ -5359,6 +5481,7 @@ Failed to find [TYPE] named [DESC] in database.
<notification
icon="notify.tga"
name="ShareToWebFailed"
+ persist="true"
type="notify">
Failed to upload image to web.
</notification>
@@ -5366,6 +5489,7 @@ Failed to find [TYPE] named [DESC] in database.
<notification
icon="notify.tga"
name="InvalidWearable"
+ persist="true"
type="notify">
The item you are trying to wear uses a feature that your Viewer can&apos;t read. Please upgrade your version of [APP_NAME] to wear this item.
</notification>
@@ -5373,6 +5497,7 @@ The item you are trying to wear uses a feature that your Viewer can&apos;t read.
<notification
icon="notify.tga"
name="ScriptQuestion"
+ persist="true"
type="notify">
&apos;[OBJECTNAME]&apos;, an object owned by &apos;[NAME]&apos;, would like to:
@@ -5398,6 +5523,7 @@ Is this OK?
icon="notify.tga"
name="ScriptQuestionCaution"
priority="high"
+ persist="true"
type="notify">
An object named &apos;[OBJECTNAME]&apos;, owned by &apos;[NAME]&apos; would like to:
@@ -5425,6 +5551,7 @@ Grant this request?
<notification
icon="notify.tga"
name="ScriptDialog"
+ persist="true"
type="notify">
[FIRST] [LAST]&apos;s &apos;[TITLE]&apos;
[MESSAGE]
@@ -5439,6 +5566,7 @@ Grant this request?
<notification
icon="notify.tga"
name="ScriptDialogGroup"
+ persist="true"
type="notify">
[GROUPNAME]&apos;s &apos;[TITLE]&apos;
[MESSAGE]
@@ -5454,6 +5582,7 @@ Grant this request?
<notification
icon="notify.tga"
name="FirstBalanceIncrease"
+ persist="true"
type="notify">
You just received L$[AMOUNT].
Your L$ balance is shown in the upper-right.
@@ -5462,6 +5591,7 @@ Your L$ balance is shown in the upper-right.
<notification
icon="notify.tga"
name="FirstBalanceDecrease"
+ persist="true"
type="notify">
You just paid L$[AMOUNT].
Your L$ balance is shown in the upper-right.
@@ -5471,6 +5601,7 @@ Your L$ balance is shown in the upper-right.
<notification
icon="notify.tga"
name="BuyLindenDollarSuccess"
+ persist="true"
type="notify">
Thank you for your payment!
@@ -5483,6 +5614,7 @@ The status of your payment can be checked on your Transaction History page on yo
<notification
icon="notify.tga"
name="FirstSit"
+ persist="true"
type="notify">
You are sitting.
Use your arrow keys (or AWSD) to look around.
@@ -5492,6 +5624,7 @@ Click the &apos;Stand Up&apos; button to stand.
<notification
icon="notify.tga"
name="FirstMap"
+ persist="true"
type="notify">
Click and drag the map to look around.
Double-click to teleport.
@@ -5501,6 +5634,7 @@ Use the controls on the right to find things and display different backgrounds.
<notification
icon="notify.tga"
name="FirstBuild"
+ persist="true"
type="notify">
You have opened the Build Tools. Every object you see around you was created using these tools.
</notification>
@@ -5510,6 +5644,7 @@ You have opened the Build Tools. Every object you see around you was created usi
<notification
icon="notify.tga"
name="FirstLeftClickNoHit"
+ persist="true"
type="notify">
Left-clicking interacts with special objects.
If the mouse pointer changes to a hand, you can interact with the object.
@@ -5519,6 +5654,7 @@ You have opened the Build Tools. Every object you see around you was created usi
<notification
icon="notify.tga"
name="FirstTeleport"
+ persist="true"
type="notify">
You can only teleport to certain areas in this region. The arrow points to your specific destination. Click the arrow to dismiss it.
</notification>
@@ -5528,6 +5664,7 @@ You can only teleport to certain areas in this region. The arrow points to your
<notification
icon="notify.tga"
name="FirstOverrideKeys"
+ persist="true"
type="notify">
Your movement keys are now being handled by an object.
Try the arrow keys or AWSD to see what they do.
@@ -5539,6 +5676,7 @@ Press &apos;M&apos; to do this.
<notification
icon="notify.tga"
name="FirstAppearance"
+ persist="true"
type="notify">
You are editing your Appearance.
Use the arrow keys to look around.
@@ -5548,6 +5686,7 @@ When you are done, press &apos;Save All&apos;.
<notification
icon="notify.tga"
name="FirstInventory"
+ persist="true"
type="notify">
This is your Inventory, which contains items you own.
@@ -5560,6 +5699,7 @@ This is your Inventory, which contains items you own.
<notification
icon="notify.tga"
name="FirstSandbox"
+ persist="true"
type="notify">
This is a sandbox area, and is meant to help Residents learn how to build.
@@ -5570,6 +5710,7 @@ Things you build here will be deleted after you leave, so don&apos;t forget to r
<notification
icon="notify.tga"
name="FirstFlexible"
+ persist="true"
type="notify">
This object is flexible. Flexis must be phantom and not physical.
</notification>
@@ -5577,6 +5718,7 @@ This object is flexible. Flexis must be phantom and not physical.
<notification
icon="notify.tga"
name="FirstDebugMenus"
+ persist="true"
type="notify">
You opened the Advanced menu.
@@ -5589,6 +5731,7 @@ To toggle this menu,
<notification
icon="notify.tga"
name="FirstSculptedPrim"
+ persist="true"
type="notify">
You are editing a Sculpted prim. Sculpties require a special texture to define their shape.
</notification>
@@ -5598,6 +5741,7 @@ You are editing a Sculpted prim. Sculpties require a special texture to define t
<notification
icon="notify.tga"
name="FirstMedia"
+ persist="true"
type="notify">
You have begun playing media. Media can set to play automatically in the preferences window under Audio / Video. Note that this can be a security risk for media sites you do not trust.
</notification>
@@ -5638,6 +5782,7 @@ Click Accept to join the call or Decline to decline the invitation. Click Block
<notification
icon="notify.tga"
name="AutoUnmuteByIM"
+ persist="true"
type="notify">
[FIRST] [LAST] was sent an instant message and has been automatically unblocked.
</notification>
@@ -5645,6 +5790,7 @@ Click Accept to join the call or Decline to decline the invitation. Click Block
<notification
icon="notify.tga"
name="AutoUnmuteByMoney"
+ persist="true"
type="notify">
[FIRST] [LAST] was given money and has been automatically unblocked.
</notification>
@@ -5652,6 +5798,7 @@ Click Accept to join the call or Decline to decline the invitation. Click Block
<notification
icon="notify.tga"
name="AutoUnmuteByInventory"
+ persist="true"
type="notify">
[FIRST] [LAST] was offered inventory and has been automatically unblocked.
</notification>
@@ -5979,6 +6126,36 @@ Drag items from inventory onto a person in the resident picker
Avatar '[NAME]' rezzed in [TIME] seconds.
</notification>
+ <notification
+ icon="alertmodal.tga"
+ name="ConfirmLeaveCall"
+ type="alert">
+Are you sure you want to leave this call?
+ <usetemplate
+ ignoretext="Confirm before I leave call"
+ name="okcancelignore"
+ notext="No"
+ yestext="Yes"/>
+ <unique/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="ConfirmMuteAll"
+ type="alert">
+You have selected to mute all participants in a group call.
+This will also cause all residents that later join the call to be
+muted, even after you have left the call.
+
+Mute everyone?
+ <usetemplate
+ ignoretext="Confirm before I mute all participants in a group call"
+ name="okcancelignore"
+ notext="Ok"
+ yestext="Cancel"/>
+ <unique/>
+ </notification>
+
<global name="UnsupportedCPU">
- Your CPU speed does not meet the minimum requirements.
</global>
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index e412c491fd..7b11538ccc 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -1,28 +1,30 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
- mouse_opaque="true"
background_visible="true"
bg_alpha_color="DkGray"
bg_opaque_color="DkGray"
+ chrome="true"
follows="left|bottom|right"
height="33"
layout="topleft"
left="0"
name="bottom_tray"
top="28"
- chrome="true"
- border_visible="false"
width="1000">
- <string name="SpeakBtnToolTip">Turns microphone on/off</string>
- <string name="VoiceControlBtnToolTip">Shows/hides voice control panel</string>
+ <string
+ name="SpeakBtnToolTip"
+ value="Turns microphone on/off" />
+ <string
+ name="VoiceControlBtnToolTip"
+ value="Shows/hides voice control panel" />
<layout_stack
- mouse_opaque="false"
border_size="0"
clip="false"
follows="all"
height="28"
layout="topleft"
left="0"
+ mouse_opaque="false"
name="toolbar_stack"
orientation="horizontal"
top="0"
@@ -33,288 +35,234 @@
height="10"
image_name="spacer24.tga"
layout="topleft"
- min_width="2"
left="0"
+ min_width="2"
top="0"
width="2" />
<layout_panel
- mouse_opaque="false"
auto_resize="false"
+ filename="panel_nearby_chat_bar.xml"
follows="left|right"
height="28"
layout="topleft"
left="0"
- min_height="23"
- width="310"
- top="4"
max_width="320"
+ min_height="23"
min_width="216"
+ mouse_opaque="false"
name="chat_bar"
+ top="4"
user_resize="false"
- filename="panel_nearby_chat_bar.xml" />
+ width="310" />
<layout_panel
- mouse_opaque="false"
auto_resize="false"
follows="right"
height="28"
layout="topleft"
min_height="28"
- width="105"
- top_delta="0"
- min_width="54"
+ min_width="57"
+ mouse_opaque="false"
name="speak_panel"
- user_resize="false">
- <talk_button
- follows="left|right"
- height="23"
- speak_button.tab_stop="true"
- show_button.tab_stop="true"
- layout="topleft"
- left="0"
- name="talk"
- top="5"
- width="105">
- <!-- do not remove halign attribute with default value. otherwise it can't be overridden in other locales.
- & pad_right is default value for long label which can be right aligned. See EXT-6318 -->
- <speak_button
- halign="center"
- name="speak_btn"
- label="Speak"
- label_selected="Speak"
- pad_right="22"
- use_ellipses="true"
- />
- <show_button>
- <show_button.init_callback
- function="Button.SetDockableFloaterToggle"
- parameter="voice_controls" />
- </show_button>
- </talk_button>
+ top_delta="0"
+ user_resize="false"
+ width="108">
+ <talk_button
+ follows="left|right"
+ height="23"
+ layout="topleft"
+ left="0"
+ name="talk"
+ top="5"
+ width="105">
+ <show_button
+ tab_stop="true">
+ <init_callback
+ function="Button.SetDockableFloaterToggle"
+ parameter="voice_controls" />
+ </show_button>
+ <!-- do not remove halign attribute with default value. otherwise it can't be overridden in other locales.
+ & pad_right is default value for long label which can be right aligned. See EXT-6318 -->
+ <speak_button
+ halign="center"
+ label="Speak"
+ label_selected="Speak"
+ name="speak_btn"
+ pad_right="22"
+ tab_stop="true"
+ use_ellipses="true" />
+ </talk_button>
</layout_panel>
- <icon
- auto_resize="false"
- follows="left|right"
- height="10"
- image_name="spacer24.tga"
- layout="topleft"
- left="0"
- name="after_speak_panel"
- min_width="3"
- top="0"
- width="3"/>
<layout_panel
- mouse_opaque="false"
auto_resize="false"
follows="right"
height="28"
layout="topleft"
min_height="28"
- width="82"
- top_delta="0"
- min_width="62"
+ min_width="65"
+ mouse_opaque="false"
name="gesture_panel"
- user_resize="false">
- <gesture_combo_list
- follows="left|right"
- height="23"
- label="Gesture"
- layout="topleft"
- name="Gesture"
- left="0"
- top="5"
- width="82"
- tool_tip="Shows/hides gestures">
- <gesture_combo_list.combo_button
- pad_right="10"
- use_ellipses="true" />
- <gesture_combo_list.combo_list
- page_lines="17" />
- </gesture_combo_list>
+ top_delta="0"
+ user_resize="false"
+ width="85">
+ <gesture_combo_list
+ follows="left|right"
+ height="23"
+ label="Gesture"
+ layout="topleft"
+ left="0"
+ name="Gesture"
+ tool_tip="Shows/hides gestures"
+ top="5"
+ width="82">
+ <combo_button
+ pad_right="10"
+ use_ellipses="true" />
+ <combo_list
+ page_lines="17" />
+ </gesture_combo_list>
</layout_panel>
- <icon
- auto_resize="false"
- color="0 0 0 0"
- follows="left|right"
- height="10"
- image_name="spacer24.tga"
- layout="topleft"
- left="0"
- min_width="3"
- name="after_gesture_panel"
- top="0"
- width="3"/>
<layout_panel
- mouse_opaque="false"
auto_resize="false"
follows="right"
height="28"
layout="topleft"
min_height="28"
+ min_width="52"
+ mouse_opaque="false"
name="movement_panel"
user_resize="false"
- width="80"
- min_width="49">
+ width="83">
<button
- image_selected="PushButton_Selected_Press"
- image_pressed="PushButton_Press"
- image_pressed_selected="PushButton_Selected_Press"
follows="left|right"
height="23"
- use_ellipses="true"
+ image_pressed="PushButton_Press"
+ image_pressed_selected="PushButton_Selected_Press"
+ image_selected="PushButton_Selected_Press"
is_toggle="true"
label="Move"
layout="topleft"
name="movement_btn"
tool_tip="Shows/hides movement controls"
top="5"
+ use_ellipses="true"
width="80">
- <button.init_callback
+ <init_callback
function="Button.SetDockableFloaterToggle"
parameter="moveview" />
</button>
</layout_panel>
- <icon
- auto_resize="false"
- color="0 0 0 0"
- follows="left|right"
- height="10"
- image_name="spacer24.tga"
- layout="topleft"
- left="0"
- min_width="3"
- name="after_movement_panel"
- top="0"
- width="3"/>
<layout_panel
- mouse_opaque="false"
auto_resize="false"
follows="left|right"
height="28"
layout="topleft"
min_height="28"
- min_width="49"
+ min_width="52"
+ mouse_opaque="false"
name="cam_panel"
user_resize="false"
- width="80">
+ width="83">
<button
- image_selected="PushButton_Selected_Press"
- image_pressed="PushButton_Press"
- image_pressed_selected="PushButton_Selected_Press"
follows="left|right"
height="23"
- use_ellipses="true"
+ image_pressed="PushButton_Press"
+ image_pressed_selected="PushButton_Selected_Press"
+ image_selected="PushButton_Selected_Press"
is_toggle="true"
label="View"
layout="topleft"
left="0"
+ name="camera_btn"
tool_tip="Shows/hides camera controls"
top="5"
- name="camera_btn"
+ use_ellipses="true"
width="80">
- <button.init_callback
+ <init_callback
function="Button.SetDockableFloaterToggle"
parameter="camera" />
</button>
</layout_panel>
- <icon
- auto_resize="false"
- color="0 0 0 0"
- follows="left|right"
- height="10"
- image_name="spacer24.tga"
- layout="topleft"
- left="0"
- min_width="3"
- name="after_cam_panel"
- top="0"
- width="3"/>
<layout_panel
- mouse_opaque="false"
auto_resize="false"
follows="left|right"
height="28"
layout="topleft"
min_width="40"
+ mouse_opaque="false"
name="snapshot_panel"
width="40">
<button
- follows="left|right"
+ follows="left|right"
height="23"
- image_selected="PushButton_Selected_Press"
+ image_overlay="Snapshot_Off"
image_pressed="PushButton_Press"
image_pressed_selected="PushButton_Selected_Press"
- left="0"
- label=""
+ image_selected="PushButton_Selected_Press"
+ is_toggle="true"
layout="topleft"
+ left="0"
name="snapshots"
- width="36"
+ tool_tip="Take snapshot"
top="5"
- is_toggle="true"
- image_overlay="Snapshot_Off"
- tool_tip="Take snapshot">
- <button.init_callback
- function="Button.SetFloaterToggle"
- parameter="snapshot" />
- </button>
- </layout_panel>
+ width="36">
+ <init_callback
+ function="Button.SetFloaterToggle"
+ parameter="snapshot" />
+ </button>
+ </layout_panel>
<layout_panel
- mouse_opaque="false"
follows="left|right"
height="30"
layout="topleft"
- top="0"
- name="chiclet_list_panel"
- width="189"
min_width="95"
+ mouse_opaque="false"
+ name="chiclet_list_panel"
+ top="0"
user_resize="false"
- auto_resize="true">
+ width="189">
<!--*NOTE: min_width of the chiclet_panel (chiclet_list) must be the same
as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. EXT-991-->
<chiclet_panel
- mouse_opaque="false"
+ chiclet_padding="4"
follows="left|right"
height="24"
layout="topleft"
left="1"
min_width="95"
+ mouse_opaque="false"
name="chiclet_list"
top="7"
- chiclet_padding="4"
- scrolling_offset="40"
width="189">
<button
auto_resize="true"
follows="right"
height="29"
+ image_hover_selected="SegmentedBtn_Left_Over"
+ image_hover_unselected="SegmentedBtn_Left_Over"
+ image_overlay="Arrow_Small_Left"
+ image_pressed="SegmentedBtn_Left_Press"
+ image_pressed_selected="SegmentedBtn_Left_Press"
image_selected="SegmentedBtn_Left_Off"
image_unselected="SegmentedBtn_Left_Off"
- image_hover_selected="SegmentedBtn_Left_Over"
- image_hover_unselected="SegmentedBtn_Left_Over"
- image_pressed="SegmentedBtn_Left_Press"
- image_pressed_selected="SegmentedBtn_Left_Press"
- image_overlay="Arrow_Small_Left"
layout="topleft"
name="chicklet_left_scroll_button"
- scale_image="true"
tab_stop="false"
top="-4"
- right_pad="2"
visible="false"
width="7" />
<button
auto_resize="true"
follows="right"
height="29"
+ image_hover_selected="SegmentedBtn_Right_Over"
+ image_hover_unselected="SegmentedBtn_Right_Over"
+ image_overlay="Arrow_Small_Right"
+ image_pressed="SegmentedBtn_Right_Press"
+ image_pressed_selected="SegmentedBtn_Right_Press"
image_selected="SegmentedBtn_Right_Off"
image_unselected="SegmentedBtn_Right_Off"
- image_hover_selected="SegmentedBtn_Right_Over"
- image_hover_unselected="SegmentedBtn_Right_Over"
- image_pressed="SegmentedBtn_Right_Press"
- image_pressed_selected="SegmentedBtn_Right_Press"
- image_overlay="Arrow_Small_Right"
layout="topleft"
name="chicklet_right_scroll_button"
- scale_image="true"
tab_stop="false"
top="-4"
visible="false"
@@ -332,24 +280,24 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly.
min_width="4"
name="DUMMY"
top="0"
- width="4"/>
+ width="4" />
<layout_panel
auto_resize="false"
follows="right"
height="28"
layout="topleft"
min_height="28"
- top="0"
- name="im_well_panel"
- width="37"
min_width="37"
- user_resize="false">
+ name="im_well_panel"
+ top="0"
+ user_resize="false"
+ width="37">
<chiclet_im_well
- max_displayed_count="99"
follows="right"
height="28"
layout="topleft"
left="0"
+ max_displayed_count="99"
name="im_well"
top="0"
width="35">
@@ -375,8 +323,8 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well
left="0"
name="Unread IM messages"
tool_tip="Conversations"
- width="34" >
- <button.init_callback
+ width="34">
+ <init_callback
function="Button.SetDockableFloaterToggle"
parameter="im_well_window" />
</button>
@@ -388,11 +336,11 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well
height="28"
layout="topleft"
min_height="28"
- top="0"
- name="notification_well_panel"
- width="37"
min_width="37"
- user_resize="false">
+ name="notification_well_panel"
+ top="0"
+ user_resize="false"
+ width="37">
<chiclet_notification
follows="right"
height="23"
@@ -402,27 +350,27 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well
name="notification_well"
top="5"
width="35">
- <button
+ <button
+ auto_resize="true"
bottom_pad="3"
+ follows="right"
+ halign="center"
+ height="23"
+ image_overlay="Notices_Unread"
+ image_overlay_alignment="center"
image_pressed="WellButton_Lit"
image_pressed_selected="WellButton_Lit_Selected"
image_selected="PushButton_Press"
- auto_resize="true"
- halign="center"
- height="23"
- follows="right"
- label_color="Black"
- left="0"
- name="Unread"
- image_overlay="Notices_Unread"
- image_overlay_alignment="center"
- tool_tip="Notifications"
- width="34" >
- <button.init_callback
- function="Button.SetDockableFloaterToggle"
- parameter="notification_well_window" />
- </button>
- </chiclet_notification>
+ label_color="Black"
+ left="0"
+ name="Unread"
+ tool_tip="Notifications"
+ width="34">
+ <init_callback
+ function="Button.SetDockableFloaterToggle"
+ parameter="notification_well_window" />
+ </button>
+ </chiclet_notification>
</layout_panel>
</layout_stack>
</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml b/indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml
new file mode 100644
index 0000000000..2f37b9d3c9
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ follows="top|right|left"
+ height="23"
+ layout="topleft"
+ left="0"
+ name="deletable_wearable_item"
+ top="0"
+ width="380">
+ <icon
+ follows="top|right|left"
+ height="20"
+ image_name="ListItem_Over"
+ layout="topleft"
+ left="0"
+ name="hovered_icon"
+ top="0"
+ visible="false"
+ width="380" />
+ <icon
+ height="20"
+ follows="top|right|left"
+ image_name="ListItem_Select"
+ layout="topleft"
+ left="0"
+ name="selected_icon"
+ top="0"
+ visible="false"
+ width="380" />
+ <button
+ name="btn_delete"
+ layout="topleft"
+ follows="top|left"
+ image_unselected="Toast_CloseBtn"
+ image_selected="Toast_CloseBtn"
+ top="0"
+ left="0"
+ height="20"
+ width="20"
+ tab_stop="false" />
+ <icon
+ height="16"
+ follows="top|left"
+ image_name="Inv_Object"
+ layout="topleft"
+ left_pad="3"
+ name="item_icon"
+ top="2"
+ width="16" />
+ <text
+ follows="left|right"
+ height="16"
+ layout="topleft"
+ left_pad="5"
+ allow_html="false"
+ use_ellipses="true"
+ name="item_name"
+ text_color="white"
+ top="4"
+ value="..."
+ width="359" />
+ <panel
+ background_visible="true"
+ bg_alpha_color="0.4 0.4 0.4 1.0"
+ bottom="0"
+ follows="left|right|top"
+ height="1"
+ layout="bottomleft"
+ left="0"
+ name="wearable_type_separator_panel"
+ visible="true"
+ width="380"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shape.xml b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
index e1c574001a..76842e5279 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shape.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
@@ -8,54 +8,19 @@
name="edit_shape_panel"
top_pad="10"
width="333" >
- <panel
- border="false"
- bg_alpha_color="DkGray2"
- bg_opaque_color="DkGray2"
- background_visible="true"
- background_opaque="true"
+ <text
follows="top|left|right"
- height="50"
- left="10"
+ font="SansSerifSmallBold"
+ halign="right"
+ height="12"
layout="topleft"
- name="avatar_sex_panel"
+ left="0"
+ name="avatar_height"
+ text_color="EmphasisColor"
top="0"
- width="313" >
- <text
- follows="top|left"
- height="16"
- layout="topleft"
- left="10"
- name="gender_text"
- width="313">
- Gender:
- </text>
- <radio_group
- follows="left|top|right"
- left="10"
- height="28"
- layout="topleft"
- name="sex_radio"
- top_pad="3"
- width="303" >
- <radio_item
- follows="all"
- height="16"
- label="Female"
- layout="topleft"
- left="10"
- name="radio"
- width="82" />
- <radio_item
- follows="all"
- height="16"
- label="Male"
- layout="topleft"
- left_pad="10"
- name="radio2"
- width="82" />
- </radio_group>
- </panel>
+ width="310">
+ [HEIGHT] Meters tall
+ </text>
<panel
border="false"
bg_alpha_color="DkGray2"
@@ -63,17 +28,17 @@
background_visible="true"
background_opaque="true"
follows="all"
- height="345"
+ height="388"
label="Shirt"
layout="topleft"
left="10"
name="accordion_panel"
- top_pad="10"
+ top_pad="0"
width="313">
<accordion
layout="topleft"
follows="all"
- height ="345"
+ height ="388"
left="0"
name="wearable_accordion"
top="0"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
index dc2f085356..afcd4550ca 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
@@ -165,12 +165,59 @@ left="0"
width="313">
<text
follows="top|left|right"
+ font="SansSerifSmallBold"
height="16"
layout="topleft"
left="10"
name="description_text"
+ text_color="white"
+ top="10"
value="Shape:"
- width="303" />
+ width="150" />
+ <radio_group
+ follows="left|top|right"
+ left="210"
+ height="20"
+ layout="topleft"
+ name="sex_radio"
+ top="5"
+ width="110">
+ <radio_item
+ follows="all"
+ height="16"
+ label=""
+ layout="topleft"
+ left="0"
+ name="sex_male"
+ tool_tip="Male"
+ width="40" />
+ <radio_item
+ follows="all"
+ height="16"
+ label=""
+ layout="topleft"
+ left_pad="10"
+ name="sex_female"
+ tool_tip="Female"
+ width="40" />
+ </radio_group>
+ <!-- graphical labels for the radio buttons above -->
+ <icon
+ height="16"
+ image_name="icons/Male.png"
+ left="230"
+ name="male_icon"
+ tool_tip="Male"
+ top="7"
+ width="16" />
+ <icon
+ height="16"
+ image_name="icons/Female.png"
+ name="female_icon"
+ left="280"
+ tool_tip="Female"
+ top="7"
+ width="16" />
<text_editor
follows="all"
height="23"
@@ -178,6 +225,7 @@ left="0"
layout="topleft"
max_length="300"
name="description"
+ top_pad="3"
width="290" />
</panel>
<panel
@@ -186,8 +234,10 @@ left="0"
layout="topleft"
left="0"
name="edit_subpanel_container"
- top_pad="10"
+ top_pad="2"
width="333">
+ <!-- the shape editing panel is taller than the others
+ because it also displays avatar height -->
<panel
filename="panel_edit_shape.xml"
follows="all"
@@ -201,141 +251,141 @@ left="0"
<panel
filename="panel_edit_skin.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_skin_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_hair.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_hair_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_eyes.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_eyes_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_shirt.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_shirt_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_pants.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_pants_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_shoes.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_shoes_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_socks.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_socks_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_jacket.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_jacket_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_skirt.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_skirt_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_gloves.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_gloves_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_undershirt.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_undershirt_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_underpants.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_underpants_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_alpha.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_alpha_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
<panel
filename="panel_edit_tattoo.xml"
follows="all"
- height="400"
+ height="392"
layout="topleft"
left="0"
name="edit_tattoo_panel"
- top="0"
+ top="8"
visible="false"
width="333" />
</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index 9341d433e8..e79ae34627 100644
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -28,6 +28,7 @@ Hover your mouse over the options for more help.
width="304"
layout="topleft">
<texture_picker
+ default_image_name="Generic_Group_Large"
follows="left|top"
height="110"
label=""
diff --git a/indra/newview/skins/default/xui/en/panel_group_notices.xml b/indra/newview/skins/default/xui/en/panel_group_notices.xml
index 479629f6ea..19fe2ea874 100644
--- a/indra/newview/skins/default/xui/en/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_notices.xml
@@ -210,9 +210,23 @@ Maximum 200 per group daily
<button
follows="left|top"
layout="topleft"
+ left="20"
+ top_delta="50"
+ height="23"
+ width="100"
+ name="open_inventory"
+ label="Inventory"
+ tool_tip="Open Inventory">
+ <button.init_callback
+ function="Button.SetFloaterToggle"
+ parameter="inventory"/>
+ </button>
+ <button
+ follows="left|top"
+ layout="topleft"
left="140"
name="remove_attachment"
- top_delta="50"
+ top_delta="0"
height="18"
image_selected="TrashItem_Press"
image_unselected="TrashItem_Off"
@@ -230,7 +244,7 @@ Maximum 200 per group daily
name="send_notice"
width="100" />
<group_drop_target
- height="95"
+ height="75"
top="160"
left="10"
layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index a725548e61..a86762f53d 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -56,42 +56,23 @@ height="80">
follows="left|bottom"
font="SansSerifSmall"
height="16"
-name="first_name_text"
+name="username_text"
top="20"
left="20"
width="150">
-First name:
+Username:
</text>
<line_editor
follows="left|bottom"
height="22"
-label="First"
+label="Username"
left_delta="0"
max_length="31"
-name="first_name_edit"
+name="username_edit"
select_on_focus="true"
-tool_tip="[SECOND_LIFE] First Name"
+tool_tip="[SECOND_LIFE] Username"
top_pad="0"
- width="135" />
- <text
- follows="left|bottom"
- font="SansSerifSmall"
- height="16"
- left_pad="8"
- name="last_name_text"
- top="20"
- width="150">
- Last name: </text>
-<line_editor
-follows="left|bottom"
-height="22"
-label="Last"
-max_length="31"
-name="last_name_edit"
-select_on_focus="true"
-tool_tip="[SECOND_LIFE] Last Name"
- top_pad="0"
- width="135" />
+width="150" />
<text
follows="left|bottom"
font="SansSerifSmall"
@@ -104,6 +85,7 @@ top="20"
</text>
<line_editor
follows="left|bottom"
+handle_edit_keys_directly="true"
height="22"
max_length="16"
name="password_edit"
@@ -167,6 +149,7 @@ allow_text_entry="true"
font="SansSerifSmall"
follows="left|right|bottom"
height="23"
+ max_chars="256"
layout="topleft"
top_pad="2"
name="server_combo"
@@ -201,7 +184,7 @@ height="16"
name="forgot_password_text"
top_pad="12"
right="-10"
- width="215">
+ width="180">
Forgot your name or password?
</text>
<text
@@ -213,7 +196,7 @@ height="16"
name="login_help"
top_pad="2"
right="-10"
- width="220">
+ width="180">
Need help logging in? </text>
<!-- <text
follows="right|bottom"
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index 46625144e1..d65b86f007 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -84,7 +84,7 @@
sort_order_setting="InventorySortOrder"
top="16"
width="288" />
- <inventory_panel
+ <recent_inventory_panel
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
@@ -100,62 +100,94 @@
name="Recent Items"
width="290" />
</tab_container>
-
- <panel
- background_visible="true"
+ <layout_stack
+ animate="false"
+ background_visible="true"
bevel_style="none"
+ border_size="0"
follows="left|right|bottom"
- height="27"
+ height="25"
layout="topleft"
- top_pad="-1"
+ orientation="horizontal"
+ top_pad="0"
left="10"
name="bottom_panel"
- width="310">
- <button
- follows="bottom|left"
- tool_tip="Show additional options"
- height="25"
- image_hover_unselected="Toolbar_Left_Over"
- image_overlay="OptionsMenu_Off"
- image_selected="Toolbar_Left_Selected"
- image_unselected="Toolbar_Left_Off"
- layout="topleft"
- left="0"
- name="options_gear_btn"
- top="1"
- width="31" />
- <button
- follows="bottom|left"
- height="25"
- image_hover_unselected="Toolbar_Middle_Over"
- image_overlay="AddItem_Off"
- image_selected="Toolbar_Middle_Selected"
- image_unselected="Toolbar_Middle_Off"
- layout="topleft"
- left_pad="1"
- name="add_btn"
- tool_tip="Add new item"
- width="31" />
- <icon
- follows="bottom|left"
- height="25"
- image_name="Toolbar_Middle_Off"
- layout="topleft"
- left_pad="1"
- name="dummy_icon"
- width="209"
- />
- <dnd_button
- follows="bottom|left"
- height="25"
- image_hover_unselected="Toolbar_Right_Over"
- image_overlay="TrashItem_Off"
- image_selected="Toolbar_Right_Selected"
- image_unselected="Toolbar_Right_Off"
- left_pad="1"
- layout="topleft"
- name="trash_btn"
- tool_tip="Remove selected item"
- width="31"/>
- </panel>
+ width="307">
+ <layout_panel
+ auto_resize="false"
+ height="25"
+ layout="topleft"
+ name="options_gear_btn_panel"
+ width="32">
+ <button
+ follows="bottom|left"
+ tool_tip="Show additional options"
+ height="25"
+ image_hover_unselected="Toolbar_Left_Over"
+ image_overlay="OptionsMenu_Off"
+ image_selected="Toolbar_Left_Selected"
+ image_unselected="Toolbar_Left_Off"
+ layout="topleft"
+ left="0"
+ name="options_gear_btn"
+ top="0"
+ width="31" />
+ </layout_panel>
+ <layout_panel
+ auto_resize="false"
+ height="25"
+ layout="topleft"
+ name="add_btn_panel"
+ width="32">
+ <button
+ follows="bottom|left"
+ height="25"
+ image_hover_unselected="Toolbar_Middle_Over"
+ image_overlay="AddItem_Off"
+ image_selected="Toolbar_Middle_Selected"
+ image_unselected="Toolbar_Middle_Off"
+ layout="topleft"
+ left="0"
+ name="add_btn"
+ tool_tip="Add new item"
+ top="0"
+ width="31" />
+ </layout_panel>
+ <layout_panel
+ auto_resize="true"
+ height="25"
+ layout="topleft"
+ name="dummy_panel"
+ width="212">
+ <icon
+ follows="bottom|left|right"
+ height="25"
+ image_name="Toolbar_Middle_Off"
+ layout="topleft"
+ left="0"
+ top="0"
+ name="dummy_icon"
+ width="211" />
+ </layout_panel>
+ <layout_panel
+ auto_resize="false"
+ height="25"
+ layout="topleft"
+ name="trash_btn_panel"
+ width="31">
+ <dnd_button
+ follows="bottom|left"
+ height="25"
+ image_hover_unselected="Toolbar_Right_Over"
+ image_overlay="TrashItem_Off"
+ image_selected="Toolbar_Right_Selected"
+ image_unselected="Toolbar_Right_Off"
+ left="0"
+ layout="topleft"
+ name="trash_btn"
+ tool_tip="Remove selected item"
+ top="0"
+ width="31"/>
+ </layout_panel>
+ </layout_stack>
</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
index 6a212306d6..7961664516 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -15,6 +15,12 @@
<string
name="No Outfit"
value="No Outfit"/>
+ <string
+ name="unsaved_changes"
+ value="Unsaved Changes"/>
+ <string
+ name="now_editing"
+ value="Now Editing"/>
<panel.string
name="not_available">
@@ -209,124 +215,120 @@
tab_group="2"
user_resize="true"
visible="false">
-
- <!-- *NOTE is not used, invisible and disabled -->
- <filter_editor
- background_image="TextField_Search_Off"
- enabled="false"
- follows="left|top|right"
- font="SansSerif"
- label="Filter"
+ <text
+ follows="top|left|right"
+ font="SansSerifBold"
+ height="13"
layout="topleft"
left="5"
- width="290"
+ name="add_to_outfit_label"
+ text_color="LtGray"
+ top="3"
+ value="Add to Outfit:"
+ use_ellipses="true"
+ width="150" />
+ <button
+ follows="top|left|right"
height="20"
- name="look_item_filter"
- text_color="black"
- text_pad_left="25"
- visible="false"/>
+ image_hover_unselected="Toolbar_Middle_Over"
+ image_overlay=""
+ image_selected="Toolbar_Middle_Selected"
+ image_unselected="Toolbar_Middle_Off"
+ is_toggle="true"
+ label="O"
+ layout="topleft"
+ left_pad="5"
+ name="filter_button"
+ top="3"
+ width="20" />
+ <combo_box
+ follows="top|left|right"
+ height="20"
+ layout="topleft"
+ right="-5"
+ name="filter_wearables_combobox"
+ top="2"
+ width="110"/>
<layout_stack
animate="true"
follows="all"
- height="25"
- width="300"
+ height="155"
+ width="311"
layout="topleft"
- orientation="horizontal"
name="filter_panels"
- top="0"
+ top_pad="5"
left="0">
<layout_panel
+ auto_resize="true"
layout="topleft"
follows="left|top|right"
- height="25"
+ height="30"
label="IM Control Panel"
- name="filter_button_panel"
- width="150"
- auto_resize="true"
- user_resize="false">
- <text
- follows="top|left|right"
- font="SansSerifBold"
- height="13"
- layout="topleft"
- left="5"
- name="add_to_outfit_label"
- text_color="LtGray"
- top="3"
- value="Add to Outfit:"
- use_ellipses="true"
- width="270" />
- <button
- follows="top|right"
- height="20"
- image_hover_unselected="Toolbar_Middle_Over"
- image_overlay=""
- image_selected="Toolbar_Middle_Selected"
- image_unselected="Toolbar_Middle_Off"
- is_toggle="true"
- label="O"
- layout="topleft"
- right="-1"
- name="filter_button"
- top="3"
- width="20" />
+ name="filter_panel"
+ width="311"
+ user_resize="false"
+ visible="false">
+ <filter_editor
+ background_image="TextField_Search_Off"
+ enabled="true"
+ follows="left|top|right"
+ font="SansSerif"
+ label="Filter"
+ layout="topleft"
+ left="5"
+ width="290"
+ height="25"
+ name="look_item_filter"
+ text_color="black"
+ text_pad_left="25"
+ visible="true"/>
</layout_panel>
<layout_panel
auto_resize="true"
- height="25"
+ height="145"
min_width="130"
- name="filter_combobox_panel"
- width="150"
- user_resize="false"
- visible="false">
- <combo_box
- follows="top|left|right"
- height="20"
- layout="topleft"
- right="-5"
- name="filter_wearables_combobox"
- top="0"
- width="130"/>
+ name="inventory_panel"
+ width="311"
+ user_resize="true">
+ <inventory_panel
+ allow_multi_select="false"
+ border="false"
+ follows="left|top|right|bottom"
+ height="130"
+ layout="topleft"
+ left="0"
+ mouse_opaque="false"
+ name="inventory_items"
+ top_pad="5"
+ width="311"
+ visible="false"/>
+ <panel
+ name="filtered_wearables_panel"
+ background_opaque="true"
+ background_visible="true"
+ layout="topleft"
+ follows="left|top|right|bottom"
+ border="false"
+ height="130"
+ left="0"
+ mouse_opaque="false"
+ width="311"
+ top_delta="0"
+ visible="true">
+ <wearable_items_list
+ name="filtered_wearables_list"
+ allow_select="true"
+ layout="topleft"
+ follows="all"
+ width="311"
+ height="130"
+ left="0"
+ top="0"/>
+ </panel>
</layout_panel>
</layout_stack>
- <inventory_panel
- allow_multi_select="false"
- border="false"
- follows="left|top|right|bottom"
- height="155"
- layout="topleft"
- left="0"
- mouse_opaque="false"
- name="inventory_items"
- top_pad="5"
- width="300"/>
-
- <panel
- name="filtered_wearables_panel"
- background_opaque="true"
- background_visible="true"
- layout="topleft"
- follows="left|top|right|bottom"
- border="false"
- height="155"
- left="0"
- mouse_opaque="false"
- width="300"
- top_delta="0"
- visible="false">
- <wearable_items_list
- name="filtered_wearables_list"
- allow_select="true"
- layout="topleft"
- follows="all"
- width="300"
- height="155"
- left="0"
- top="0" />
- </panel>
-
<panel
background_visible="true"
bevel_style="none"
@@ -357,6 +359,7 @@
image_overlay=""
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
+ is_toggle="true"
label="F"
layout="topleft"
left_pad="1"
@@ -370,6 +373,7 @@
image_overlay=""
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
+ is_toggle="true"
label="L"
layout="topleft"
left_pad="1"
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index 7e212c9383..b79ef1e287 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -464,7 +464,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
name="view_profile_btn"
tool_tip="Show picture, groups, and other Residents information"
top="0"
- width="70" />
+ width="67" />
<button
follows="bottom|left"
left_pad="3"
@@ -473,7 +473,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
layout="topleft"
name="im_btn"
tool_tip="Open instant message session"
- width="43" />
+ width="40" />
<button
follows="bottom|left"
left_pad="3"
@@ -491,7 +491,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
layout="topleft"
name="share_btn"
tool_tip="Share an inventory item"
- width="62" />
+ width="65" />
<button
follows="bottom|left"
left_pad="3"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
index 69e8e6fdcc..0129d97616 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
@@ -94,6 +94,16 @@ Automatic position for:
name="appearance_camera_movement"
tool_tip="Use automatic camera positioning while in edit mode"
width="242" />
+ <check_box
+ control_name="SidebarCameraMovement"
+ follows="left|top"
+ height="16"
+ initial_value="1"
+ label="Sidebar"
+ layout="topleft"
+ name="appearance_sidebar_positioning"
+ tool_tip="Use automatic camera positioning for sidebar"
+ width="242" />
<icon
follows="left|top"
height="18"
diff --git a/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml b/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml
index b48943c699..3effc9de89 100644
--- a/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml
+++ b/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml
@@ -6,7 +6,7 @@
name="panel_stand_stop_flying"
mouse_opaque="false"
visible="true"
- width="115">
+ width="113">
<button
follows="left|bottom"
height="19"
@@ -16,7 +16,7 @@
tool_tip="Click here to stand up."
top="2"
visible="false"
- width="115" />
+ width="113" />
<button
follows="left|bottom"
height="19"
@@ -26,5 +26,5 @@
tool_tip="Stop flying"
top="2"
visible="false"
- width="115" />
+ width="113" />
</panel>
diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
index e74c70789f..6a3c148456 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
@@ -94,6 +94,14 @@ width="333">
name="edit_outfit_btn"
top="7"
width="30" />
+ <loading_indicator
+ follows="left|top"
+ height="24"
+ layout="topleft"
+ left="268"
+ name="wearables_loading_indicator"
+ top="6"
+ width="24" />
</panel>
<filter_editor
height="23"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index f544449d02..6d80b17ac6 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -46,6 +46,15 @@
<string name="LoginWaitingForRegionHandshake">Waiting for region handshake...</string>
<string name="LoginConnectingToRegion">Connecting to region...</string>
<string name="LoginDownloadingClothing">Downloading clothing...</string>
+ <string name="InvalidCertificate">The server returned an invalid or corrupt certificate. Please contact the Grid administrator.</string>
+ <string name="CertInvalidHostname">An invalid hostname was used to access the server, please check your SLURL or Grid hostname.</string>
+ <string name="CertExpired">The certificate returned by the Grid appears to be expired. Please check your system clock, or contact your Grid administr\
+ator.</string>
+ <string name="CertKeyUsage">The certificate returned by the server could not be used for SSL. Please contact your Grid administrator.</string>
+ <string name="CertBasicConstraints">Too many certificates were in the servers Certificate chain. Please contact your Grid administrator.</string>
+ <string name="CertInvalidSignature">The certificate signature returned by the Grid server could not be verified. Please contact your Grid administrat
+or.</string>
+
<string name="LoginFailedNoNetwork">Network Error: Could not establish connection, please check your network connection.</string>
<string name="LoginFailed">Login failed.</string>
<string name="Quit">Quit</string>
diff --git a/indra/newview/skins/default/xui/es/floater_world_map.xml b/indra/newview/skins/default/xui/es/floater_world_map.xml
index 38a12002f5..c3a13980de 100644
--- a/indra/newview/skins/default/xui/es/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/es/floater_world_map.xml
@@ -20,10 +20,10 @@
Venta de terreno
</text>
<text name="by_owner_label">
- por el propietario
+ por el dueño
</text>
<text name="auction_label">
- subasta de terreno
+ subasta
</text>
<button name="Go Home" tool_tip="Teleportar a mi Base"/>
<text name="Home_label">
diff --git a/indra/newview/skins/default/xui/es/menu_inventory.xml b/indra/newview/skins/default/xui/es/menu_inventory.xml
index ea68bc5bee..ca992fd525 100644
--- a/indra/newview/skins/default/xui/es/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/es/menu_inventory.xml
@@ -49,6 +49,8 @@
<menu_item_call label="Abrir" name="Sound Open"/>
<menu_item_call label="Reemplazar el vestuario" name="Replace Outfit"/>
<menu_item_call label="Añadir al vestuario" name="Add To Outfit"/>
+ <menu_item_call label="Quitar del vestuario actual" name="Remove From Outfit"/>
+ <menu_item_call label="Encontrar el original" name="Find Original"/>
<menu_item_call label="Eliminar el ítem" name="Purge Item"/>
<menu_item_call label="Restaurar el ítem" name="Restore Item"/>
<menu_item_call label="Abrir" name="Open"/>
@@ -58,6 +60,7 @@
<menu_item_call label="Copiar" name="Copy"/>
<menu_item_call label="Pegar" name="Paste"/>
<menu_item_call label="Pegar como enlace" name="Paste As Link"/>
+ <menu_item_call label="Quitar el enlace" name="Remove Link"/>
<menu_item_call label="Borrar" name="Delete"/>
<menu_item_call label="Borrar carpeta del sistema" name="Delete System Folder"/>
<menu_item_call label="Empezar multiconferencia" name="Conference Chat Folder"/>
diff --git a/indra/newview/skins/default/xui/es/menu_login.xml b/indra/newview/skins/default/xui/es/menu_login.xml
index df21ced9ab..101cddc6aa 100644
--- a/indra/newview/skins/default/xui/es/menu_login.xml
+++ b/indra/newview/skins/default/xui/es/menu_login.xml
@@ -6,6 +6,7 @@
</menu>
<menu label="Ayuda" name="Help">
<menu_item_call label="Ayuda de [SECOND_LIFE]" name="Second Life Help"/>
+ <menu_item_call label="Acerca de [APP_NAME]" name="About Second Life"/>
</menu>
<menu_item_check label="Mostrar el menú &apos;Debug&apos;" name="Show Debug Menu"/>
<menu label="Depurar" name="Debug">
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index f89ab9ba80..8bbb5f6be5 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -32,7 +32,7 @@
Initialisation du cache des textures...
</string>
<string name="StartupInitializingVFS">
- Initialisation VFS…
+ Initialisation VFS...
</string>
<string name="ProgressRestoring">
Restauration...
diff --git a/indra/newview/skins/default/xui/it/floater_about_land.xml b/indra/newview/skins/default/xui/it/floater_about_land.xml
index 742cdf44a5..4c3398de87 100644
--- a/indra/newview/skins/default/xui/it/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_about_land.xml
@@ -79,7 +79,7 @@ Vai al menu Mondo &gt; Informazioni sul terreno oppure seleziona un altro appezz
Categoria di accesso:
</text>
<text left="119" name="ContentRatingText">
- Adult
+ Adulti
</text>
<text name="Owner:">
Proprietario:
@@ -139,10 +139,10 @@ Vai al menu Mondo &gt; Informazioni sul terreno oppure seleziona un altro appezz
<button label="Acquista il terreno..." label_selected="Acquista il terreno..." left="130" name="Buy Land..." width="125"/>
<button label="Informazioni script" name="Scripts..."/>
<button label="Acquista per il gruppo" name="Buy For Group..."/>
- <button label="Compra pass..." label_selected="Compra pass..." left="130" name="Buy Pass..." tool_tip="Un pass ti da un accesso temporaneo in questo territorio." width="125"/>
+ <button label="Compra Pass..." label_selected="Compra Pass..." left="130" name="Buy Pass..." tool_tip="Un pass ti da un accesso temporaneo in questo territorio." width="125"/>
<button label="Abbandona la terra" name="Abandon Land..."/>
<button label="Reclama la terra" name="Reclaim Land..."/>
- <button label="Vendita Linden" name="Linden Sale..." tool_tip="La terra deve essere posseduta, con contenuto impostato, e non già messa in asta."/>
+ <button label="Vendita Linden" name="Linden Sale..." tool_tip="La terra deve essere di proprietà, con contenuto impostato, e non già messa all'asta."/>
</panel>
<panel label="REGOLAMENTO" name="land_covenant_panel">
<panel.string name="can_resell">
@@ -193,7 +193,7 @@ o suddivisa.
Categoria di accesso:
</text>
<text left="125" name="region_maturity_text">
- Adult
+ Adulti
</text>
<text name="resellable_lbl">
Rivendita:
@@ -294,16 +294,16 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
Questa opzione è disabilitata perchè tu non puoi modificare le opzioni di questo terreno.
</panel.string>
<panel.string name="mature_check_mature">
- Contenuto Mature
+ Contenuto Moderato
</panel.string>
<panel.string name="mature_check_adult">
- Contenuto Adult
+ Contenuto Adulti
</panel.string>
<panel.string name="mature_check_mature_tooltip">
- Il contenuto o le informazioni del tuo terreno sono considerate Mature.
+ Il contenuto o le informazioni del tuo terreno sono considerate di tipo Moderato.
</panel.string>
<panel.string name="mature_check_adult_tooltip">
- Il contenuto o le informazioni del tuo terreno sono considerate Adult.
+ Il contenuto o le informazioni del tuo terreno sono considerate di tipo per Adulti.
</panel.string>
<panel.string name="landing_point_none">
(nessuno)
@@ -343,10 +343,10 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
<combo_box left="282" name="land category with adult" width="140">
<combo_box.item label="Tutte le categorie" name="item0"/>
<combo_box.item label="Luogo dei Linden" name="item1"/>
- <combo_box.item label="Adult" name="item2"/>
- <combo_box.item label="Arte &amp; Cultura" name="item3"/>
+ <combo_box.item label="Adulti" name="item2"/>
+ <combo_box.item label="Arte e cultura" name="item3"/>
<combo_box.item label="Affari" name="item4"/>
- <combo_box.item label="Educazione" name="item5"/>
+ <combo_box.item label="Istruzione" name="item5"/>
<combo_box.item label="Gioco" name="item6"/>
<combo_box.item label="Divertimento" name="item7"/>
<combo_box.item label="Accoglienza nuovi residenti" name="item8"/>
@@ -369,7 +369,7 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
<combo_box.item label="Shopping" name="item11"/>
<combo_box.item label="Altro" name="item12"/>
</combo_box>
- <check_box label="Contenuto Mature" name="MatureCheck" tool_tip=" "/>
+ <check_box label="Contenuti di tipo Moderato" name="MatureCheck" tool_tip=" "/>
<text name="Snapshot:">
Fotografia:
</text>
diff --git a/indra/newview/skins/default/xui/it/floater_animation_preview.xml b/indra/newview/skins/default/xui/it/floater_animation_preview.xml
index 5472e32544..77341cad63 100644
--- a/indra/newview/skins/default/xui/it/floater_animation_preview.xml
+++ b/indra/newview/skins/default/xui/it/floater_animation_preview.xml
@@ -153,7 +153,7 @@ La lunghezza massima è [MAX_LENGTH] secondi.
<item label="Accigliato" name="Frown" value="Accigliato"/>
<item label="Bacio" name="Kiss" value="Bacio"/>
<item label="Risata" name="Laugh" value="Risata"/>
- <item label="Plllppt" name="Plllppt" value="Plllppt"/>
+ <item label="Plllppt" name="Plllppt" value="Linguaccia"/>
<item label="Repulsione" name="Repulsed" value="Repulsione"/>
<item label="Triste" name="Sad" value="Triste"/>
<item label="Scrollata di spalle" name="Shrug" value="Scrollata di spalle"/>
diff --git a/indra/newview/skins/default/xui/it/floater_report_abuse.xml b/indra/newview/skins/default/xui/it/floater_report_abuse.xml
index 4827cc739d..eeba54b0ca 100644
--- a/indra/newview/skins/default/xui/it/floater_report_abuse.xml
+++ b/indra/newview/skins/default/xui/it/floater_report_abuse.xml
@@ -67,8 +67,8 @@
<combo_box.item label="Molestie &gt; Abusi verbali" name="Harassment__Verbal_abuse"/>
<combo_box.item label="Indecenza &gt; Condotta o contenuti largamente offensivi" name="Indecency__Broadly_offensive_content_or_conduct"/>
<combo_box.item label="Indecenza &gt; Nome di un avatar inappropriato" name="Indecency__Inappropriate_avatar_name"/>
- <combo_box.item label="Indecenza &gt; Contenuto o condotta inappropriata in una regione PG" name="Indecency__Mature_content_in_PG_region"/>
- <combo_box.item label="Indecenza &gt; Contenuto o condotta inappropriata in una regione Mature" name="Indecency__Inappropriate_content_in_Mature_region"/>
+ <combo_box.item label="Indecenza &gt; Contenuto o condotta inappropriata in una regione con accesso Generale" name="Indecency__Mature_content_in_PG_region"/>
+ <combo_box.item label="Indecenza &gt; Contenuto o condotta inappropriata in una regione con accesso Moderato" name="Indecency__Inappropriate_content_in_Mature_region"/>
<combo_box.item label="Violazione della proprietà intellettuale &gt; Rimozione contenuti" name="Intellectual_property_infringement_Content_Removal"/>
<combo_box.item label="Violazione della proprietà intellettuale &gt; CopyBot o sblocco di permessi" name="Intellectual_property_infringement_CopyBot_or_Permissions_Exploit"/>
<combo_box.item label="Intolleranza" name="Intolerance"/>
diff --git a/indra/newview/skins/default/xui/it/floater_tools.xml b/indra/newview/skins/default/xui/it/floater_tools.xml
index 6ad8d68df2..cd16246f0f 100644
--- a/indra/newview/skins/default/xui/it/floater_tools.xml
+++ b/indra/newview/skins/default/xui/it/floater_tools.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="toolbox floater" short_title="STRUMENTI PER COSTRUZIONE" title="" width="288">
+<floater name="toolbox floater" short_title="STRUMENTI PER COSTRUZIONE">
<floater.string name="status_rotate">
Sposta le fasce colorate per ruotare l&apos;oggetto
</floater.string>
@@ -39,12 +39,12 @@
<floater.string name="grid_attachment_text">
Accessorio
</floater.string>
- <button label="" label_selected="" name="button focus" tool_tip="Focus"/>
- <button label="" label_selected="" name="button move" tool_tip="Muoviti"/>
+ <button label="" label_selected="" name="button focus" tool_tip="Ingrandisci"/>
+ <button label="" label_selected="" name="button move" tool_tip="Sposta"/>
<button label="" label_selected="" name="button edit" tool_tip="Modifica"/>
<button label="" label_selected="" name="button create" tool_tip="Crea"/>
- <button label="" label_selected="" name="button land" tool_tip="Terra"/>
- <text name="text status" width="280">
+ <button label="" label_selected="" name="button land" tool_tip="Terreno"/>
+ <text name="text status">
Trascina per muovere, trascina+maiuscolo per copiare
</text>
<radio_group name="focus_radio_group">
@@ -70,7 +70,7 @@
<check_box label="Ridimens. simmetricamente" name="checkbox uniform"/>
<check_box initial_value="true" label="Ridimensiona le texture" name="checkbox stretch textures"/>
<check_box initial_value="true" label="Posiziona nella griglia" name="checkbox snap to grid"/>
- <combo_box left_delta="48" name="combobox grid mode" tool_tip="Scegli il tipo di righello per posizionare l&apos;oggetto">
+ <combo_box name="combobox grid mode" tool_tip="Scegli il tipo di righello per posizionare l&apos;oggetto">
<combo_box.item label="Rete del mondo" name="World"/>
<combo_box.item label="Rete locale" name="Local"/>
<combo_box.item label="Griglia di riferimento" name="Reference"/>
@@ -110,18 +110,18 @@
<text name="Dozer Size:">
Grandezza
</text>
- <slider_bar initial_value="2.0" left="184" name="slider brush size" width="74"/>
+ <slider_bar initial_value="2.0" name="slider brush size"/>
<text name="Strength:">
Potenza
</text>
- <button label="Applica" label_selected="Applica" left="146" name="button apply to selection" tool_tip="Modifica il terreno selezionato"/>
- <text left="134" name="obj_count">
+ <button label="Applica" label_selected="Applica" name="button apply to selection" tool_tip="Modifica il terreno selezionato"/>
+ <text name="obj_count">
Oggetti: [COUNT]
</text>
- <text left="134" name="prim_count">
+ <text name="prim_count">
Prim: [COUNT]
</text>
- <tab_container name="Object Info Tabs" tab_max_width="150" tab_min_width="30" width="288">
+ <tab_container name="Object Info Tabs">
<panel label="Generale" name="General">
<panel.string name="text deed continued">
Cessione
@@ -182,12 +182,12 @@
</text>
<button label="Imposta..." label_selected="Imposta..." name="button set group" tool_tip="Scegli un gruppo con cui condividere i diritti relativi all&apos;oggetto"/>
<name_box initial_value="Caricamento in corso..." name="Group Name Proxy"/>
- <button label="Cessione" label_selected="Cessione" left_delta="152" name="button deed" tool_tip="Con una cessione si trasferisce il bene con i diritti al proprietario successivo Gli oggetti in proprietà condivisa di gruppo possono essere ceduti soltanto da un funzionario del gruppo." width="98"/>
+ <button label="Cessione" label_selected="Cessione" name="button deed" tool_tip="Con una cessione si trasferisce il bene con i diritti al proprietario successivo Gli oggetti in proprietà condivisa di gruppo possono essere ceduti soltanto da un funzionario del gruppo."/>
<check_box label="Condividi" name="checkbox share with group" tool_tip="Consenti a tutti i membri del gruppo selezionato di condividere i tuoi diritti di modifica di questo oggetto. Per attivare le restrizioni per ruolo devi prima effettuare la cessione."/>
- <text name="label click action" width="220">
+ <text name="label click action">
Fai clic per:
</text>
- <combo_box name="clickaction" width="192">
+ <combo_box name="clickaction">
<combo_box.item label="Tocca (predefinito)" name="Touch/grab(default)"/>
<combo_box.item label="Siediti sull&apos;oggetto" name="Sitonobject"/>
<combo_box.item label="Compra l&apos;oggetto" name="Buyobject"/>
@@ -216,8 +216,8 @@
Proprietario successivo:
</text>
<check_box label="Modificare" name="checkbox next owner can modify"/>
- <check_box label="Copiare" left_delta="80" name="checkbox next owner can copy"/>
- <check_box label="Trasferisci" left_delta="67" name="checkbox next owner can transfer" tool_tip="Il prossimo proprietario può regalare o rivendere questo oggetto"/>
+ <check_box label="Copiare" name="checkbox next owner can copy"/>
+ <check_box label="Trasferisci" name="checkbox next owner can transfer" tool_tip="Il prossimo proprietario può regalare o rivendere questo oggetto"/>
<text name="B:">
B:
</text>
@@ -318,7 +318,7 @@
</text>
<spinner label="X" name="Shear X"/>
<spinner label="Y" name="Shear Y"/>
- <text name="advanced_cut" width="149">
+ <text name="advanced_cut">
Riduci un bordo (inizio/fine)
</text>
<text name="advanced_dimple">
@@ -355,29 +355,29 @@
</combo_box>
</panel>
<panel label="Caratteristiche" name="Features">
- <text name="select_single" width="280">
+ <text name="select_single">
Seleziona solo un prim per modificarne le caratteristiche.
</text>
<text name="edit_object">
Modifica le caratteristiche dell&apos;oggetto:
</text>
<check_box label="Flessibilità" name="Flexible1D Checkbox Ctrl" tool_tip="Consenti all&apos;oggetto di flettersi lungo l&apos;asse Z (solo lato client)"/>
- <spinner label="Morbidezza" label_width="72" name="FlexNumSections" width="135"/>
- <spinner label="Gravità" label_width="72" name="FlexGravity" width="135"/>
- <spinner label="Elasticità" label_width="72" name="FlexFriction" width="135"/>
- <spinner label="Sventolio" label_width="72" name="FlexWind" width="135"/>
- <spinner label="Tensione" label_width="72" name="FlexTension" width="135"/>
- <spinner label="Forza X" label_width="72" name="FlexForceX" width="135"/>
- <spinner label="Forza Y" label_width="72" name="FlexForceY" width="135"/>
- <spinner label="Forza Z" label_width="72" name="FlexForceZ" width="135"/>
+ <spinner label="Morbidezza" name="FlexNumSections"/>
+ <spinner label="Gravità" name="FlexGravity"/>
+ <spinner label="Elasticità" name="FlexFriction"/>
+ <spinner label="Sventolio" name="FlexWind"/>
+ <spinner label="Tensione" name="FlexTension"/>
+ <spinner label="Forza X" name="FlexForceX"/>
+ <spinner label="Forza Y" name="FlexForceY"/>
+ <spinner label="Forza Z" name="FlexForceZ"/>
<check_box label="Luce" name="Light Checkbox Ctrl" tool_tip="Imposta l&apos;oggetto come sorgente di luce"/>
<color_swatch label="" name="colorswatch" tool_tip="Clicca per aprire il selettore dei colori"/>
<texture_picker label="" name="light texture control" tool_tip="Clicca per scegliere un&apos;immagine da proiettare (funziona solo con il rendering differito attivato)"/>
- <spinner label="Intensità" label_width="72" name="Light Intensity" width="135"/>
+ <spinner label="Intensità" name="Light Intensity"/>
<spinner label="Angolo di vista" name="Light FOV"/>
- <spinner label="Raggio" label_width="72" name="Light Radius" width="135"/>
+ <spinner label="Raggio" name="Light Radius"/>
<spinner label="Centro focale" name="Light Focus"/>
- <spinner label="Attenuazione" label_width="72" name="Light Falloff" width="135"/>
+ <spinner label="Attenuazione" name="Light Falloff"/>
<spinner label="Atmosfera" name="Light Ambiance"/>
</panel>
<panel label="Texture" name="Texture">
@@ -395,28 +395,27 @@
<text name="glow label">
Bagliore
</text>
- <check_box bottom_delta="-21" label="Massima luminosità" name="checkbox fullbright"/>
+ <check_box label="Massima luminosità" name="checkbox fullbright"/>
<text name="tex gen">
- Applicazione
-della texture
+ Applicazione
</text>
- <combo_box bottom_delta="-38" name="combobox texgen">
+ <combo_box name="combobox texgen">
<combo_box.item label="Default" name="Default"/>
<combo_box.item label="Planare" name="Planar"/>
</combo_box>
- <text bottom="-120" name="label shininess">
+ <text name="label shininess">
Brillantezza
</text>
- <combo_box bottom_delta="-22" name="combobox shininess">
+ <combo_box name="combobox shininess">
<combo_box.item label="Nessuna" name="None"/>
<combo_box.item label="Bassa" name="Low"/>
<combo_box.item label="Media" name="Medium"/>
<combo_box.item label="Alta" name="High"/>
</combo_box>
- <text bottom="-120" name="label bumpiness">
+ <text name="label bumpiness">
Rilievo
</text>
- <combo_box bottom_delta="-22" name="combobox bumpiness" width="100">
+ <combo_box name="combobox bumpiness">
<combo_box.item label="Nessuna" name="None"/>
<combo_box.item label="Luminoso" name="Brightness"/>
<combo_box.item label="Scuro" name="Darkness"/>
@@ -476,17 +475,17 @@ della texture
<text name="label_area">
Zona: [AREA] m²
</text>
- <button label="Informazioni sui terreni" label_selected="Informazioni sui terreni" name="button about land" width="156"/>
+ <button label="Informazioni sui terreni" label_selected="Informazioni sui terreni" name="button about land"/>
<check_box label="Mostra i proprietari" name="checkbox show owners" tool_tip="Colora i terreni in base ai loro proprietari: Verde = il tuo terreno Acqua = la terra del tuo gruppo Rosso = posseduta da altri Giallo = in vendita Viola = in asta Grigia = pubblica"/>
<text name="label_parcel_modify">
Modifica il terreno
</text>
- <button label="Suddividi" label_selected="Suddividi" name="button subdivide land" width="156"/>
- <button label="Iscriviti" label_selected="Iscriviti" name="button join land" width="156"/>
+ <button label="Suddividi" label_selected="Suddividi" name="button subdivide land"/>
+ <button label="Iscriviti" label_selected="Iscriviti" name="button join land"/>
<text name="label_parcel_trans">
Transazioni terreno
</text>
- <button label="Acquista terreno" label_selected="Acquista terreno" name="button buy land" width="156"/>
- <button label="Abbandona il terreno" label_selected="Abbandona il terreno" name="button abandon land" width="156"/>
+ <button label="Acquista terreno" label_selected="Acquista terreno" name="button buy land"/>
+ <button label="Abbandona il terreno" label_selected="Abbandona il terreno" name="button abandon land"/>
</panel>
</floater>
diff --git a/indra/newview/skins/default/xui/it/menu_inventory.xml b/indra/newview/skins/default/xui/it/menu_inventory.xml
index dacb257758..3b36198774 100644
--- a/indra/newview/skins/default/xui/it/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/it/menu_inventory.xml
@@ -9,28 +9,28 @@
<menu_item_call label="Elimina" name="Task Remove"/>
<menu_item_call label="Svuota il Cestino" name="Empty Trash"/>
<menu_item_call label="Svuota gli oggetti persi e ritrovati" name="Empty Lost And Found"/>
- <menu_item_call label="Nuova Cartella" name="New Folder"/>
- <menu_item_call label="Nuovo Script" name="New Script"/>
+ <menu_item_call label="Nuova cartella" name="New Folder"/>
+ <menu_item_call label="Nuovo script" name="New Script"/>
<menu_item_call label="Nuovo biglietto" name="New Note"/>
- <menu_item_call label="Nuova Gesture" name="New Gesture"/>
+ <menu_item_call label="Nuova gesture" name="New Gesture"/>
<menu label="Maglietta intima" name="New Clothes">
- <menu_item_call label="Nuova Maglietta" name="New Shirt"/>
- <menu_item_call label="Nuovi Pantaloni" name="New Pants"/>
- <menu_item_call label="Nuove Scarpe" name="New Shoes"/>
- <menu_item_call label="Nuove Calze" name="New Socks"/>
- <menu_item_call label="Nuova Giacca" name="New Jacket"/>
- <menu_item_call label="Nuova Gonna" name="New Skirt"/>
- <menu_item_call label="Nuovi Guanti" name="New Gloves"/>
- <menu_item_call label="Nuova Canottiera" name="New Undershirt"/>
- <menu_item_call label="Nuove Mutande" name="New Underpants"/>
+ <menu_item_call label="Nuova maglietta" name="New Shirt"/>
+ <menu_item_call label="Nuovi pantaloni" name="New Pants"/>
+ <menu_item_call label="Nuove scarpe" name="New Shoes"/>
+ <menu_item_call label="Nuove calze" name="New Socks"/>
+ <menu_item_call label="Nuova giacca" name="New Jacket"/>
+ <menu_item_call label="Nuova gonna" name="New Skirt"/>
+ <menu_item_call label="Nuovi guanti" name="New Gloves"/>
+ <menu_item_call label="Nuova canottiera" name="New Undershirt"/>
+ <menu_item_call label="Nuove mutande" name="New Underpants"/>
<menu_item_call label="Nuovo Alfa Mask" name="New Alpha Mask"/>
<menu_item_call label="Nuovo tatuaggio" name="New Tattoo"/>
</menu>
<menu label="Nuove parti del corpo" name="New Body Parts">
- <menu_item_call label="Nuova Forma del corpo" name="New Shape"/>
- <menu_item_call label="Nuova Pelle" name="New Skin"/>
- <menu_item_call label="Nuovi Capelli" name="New Hair"/>
- <menu_item_call label="Nuovi Occhi" name="New Eyes"/>
+ <menu_item_call label="Nuova forma del corpo" name="New Shape"/>
+ <menu_item_call label="Nuova pelle" name="New Skin"/>
+ <menu_item_call label="Nuovi capelli" name="New Hair"/>
+ <menu_item_call label="Nuovi occhi" name="New Eyes"/>
</menu>
<menu label="Cambia tipo" name="Change Type">
<menu_item_call label="Predefinito" name="Default"/>
@@ -49,6 +49,8 @@
<menu_item_call label="Apri" name="Sound Open"/>
<menu_item_call label="Sostituisci vestiti" name="Replace Outfit"/>
<menu_item_call label="Aggiungi al vestiario" name="Add To Outfit"/>
+ <menu_item_call label="Rimuovi dal vestiario attuale" name="Remove From Outfit"/>
+ <menu_item_call label="Trova originale" name="Find Original"/>
<menu_item_call label="Elimina oggetto" name="Purge Item"/>
<menu_item_call label="Ripristina oggetto" name="Restore Item"/>
<menu_item_call label="Apri" name="Open"/>
@@ -58,6 +60,7 @@
<menu_item_call label="Copia" name="Copy"/>
<menu_item_call label="Incolla" name="Paste"/>
<menu_item_call label="Incolla come link" name="Paste As Link"/>
+ <menu_item_call label="Rimuovi link" name="Remove Link"/>
<menu_item_call label="Cancella" name="Delete"/>
<menu_item_call label="Elimina la cartella di sistema" name="Delete System Folder"/>
<menu_item_call label="Inizia la conferenza chat" name="Conference Chat Folder"/>
diff --git a/indra/newview/skins/default/xui/it/menu_login.xml b/indra/newview/skins/default/xui/it/menu_login.xml
index b0edeb3618..904b819198 100644
--- a/indra/newview/skins/default/xui/it/menu_login.xml
+++ b/indra/newview/skins/default/xui/it/menu_login.xml
@@ -6,6 +6,7 @@
</menu>
<menu label="Aiuto" name="Help">
<menu_item_call label="Aiuto di [SECOND_LIFE]" name="Second Life Help"/>
+ <menu_item_call label="Informazioni su [APP_NAME]" name="About Second Life"/>
</menu>
<menu_item_check label="Mostra menu Debug" name="Show Debug Menu"/>
<menu label="Debug" name="Debug">
diff --git a/indra/newview/skins/default/xui/it/menu_viewer.xml b/indra/newview/skins/default/xui/it/menu_viewer.xml
index 8556ac7da0..a5923ac42b 100644
--- a/indra/newview/skins/default/xui/it/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/it/menu_viewer.xml
@@ -30,7 +30,7 @@
<menu_item_check label="Mappa del mondo" name="World Map"/>
<menu_item_call label="Istantanea" name="Take Snapshot"/>
<menu_item_call label="Crea punto di riferimento per questo luogo" name="Create Landmark Here"/>
- <menu label="Profilo del posto" name="Land">
+ <menu label="Profilo del luogo" name="Land">
<menu_item_call label="Profilo del luogo" name="Place Profile"/>
<menu_item_call label="Informazioni sui terreni" name="About Land"/>
<menu_item_call label="Regione/proprietà immobiliare" name="Region/Estate"/>
@@ -64,7 +64,7 @@
<menu_item_call label="Strumento Ingrandisci" name="Focus"/>
<menu_item_call label="Strumento Movimento" name="Move"/>
<menu_item_call label="Strumento Modifica" name="Edit"/>
- <menu_item_call label="Crea strumento" name="Create"/>
+ <menu_item_call label="Strumento Crea" name="Create"/>
<menu_item_call label="Strumento Terreno" name="Land"/>
</menu>
<menu_item_call label="Collegamento" name="Link"/>
@@ -182,7 +182,7 @@
<menu_item_call label="Strumento Ingrandisci" name="Focus"/>
<menu_item_call label="Strumento Movimento" name="Move"/>
<menu_item_call label="Strumento Modifica" name="Edit"/>
- <menu_item_call label="Crea strumento" name="Create"/>
+ <menu_item_call label="Strumento Crea" name="Create"/>
<menu_item_call label="Strumento Terreno" name="Land"/>
</menu>
<menu_item_call label="Zoom avanti" name="Zoom In"/>
diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml
index 0ca404d06b..4739e5cce9 100644
--- a/indra/newview/skins/default/xui/it/notifications.xml
+++ b/indra/newview/skins/default/xui/it/notifications.xml
@@ -341,7 +341,7 @@ Non ci sono rimborsi per la tariffa pagata.
<notification name="DeleteMedia">
Hai selezionato la cancellazione del media associato a questa faccia.
Vuoi continuare?
- <usetemplate ignoretext="Conferma prima di eliminare elemnti multimediali dall&apos;oggetto" name="okcancelignore" notext="No" yestext="Sì"/>
+ <usetemplate ignoretext="Conferma prima di eliminare elementi multimediali dall&apos;oggetto" name="okcancelignore" notext="No" yestext="Sì"/>
</notification>
<notification name="ClassifiedSave">
Salva le modifiche all&apos;annuncio [NAME]?
@@ -625,7 +625,7 @@ Attese [VALIDS]
Riprova più tardi.
</notification>
<notification name="LandmarkCreated">
- Hai aggiunto &quot;[LANDMARK_NAME]&quot; alla tua [FOLDER_NAME] cartella.
+ Hai aggiunto &quot;[LANDMARK_NAME]&quot; alla tua cartella [FOLDER_NAME].
</notification>
<notification name="LandmarkAlreadyExists">
Hai già il punto di riferimento di questo luogo.
@@ -1603,11 +1603,11 @@ Pubblica questo annuncio adesso per [AMOUNT]L$?
<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
</notification>
<notification name="SetClassifiedMature">
- Queste inserzioni includono contenuto Mature?
+ Queste inserzioni includono contenuti di tipo Moderato?
<usetemplate canceltext="Annulla" name="yesnocancelbuttons" notext="No" yestext="Si"/>
</notification>
<notification name="SetGroupMature">
- Questo gruppo include contenuto Mature?
+ Questo gruppo include contenuti di tipo Moderato?
<usetemplate canceltext="Annulla" name="yesnocancelbuttons" notext="No" yestext="Si"/>
</notification>
<notification label="Conferma il riavvio" name="ConfirmRestart">
@@ -1622,7 +1622,7 @@ Pubblica questo annuncio adesso per [AMOUNT]L$?
<button name="Cancel" text="Annulla"/>
</form>
</notification>
- <notification label="Cambiato il contenuto Mature" name="RegionMaturityChange">
+ <notification label="Cambiato il contenuto Moderato" name="RegionMaturityChange">
La classificazione di questa regione è stata aggiornata.
Un periodo di tempo è necessario prima che la modifica venga integrata nella mappa.
@@ -2092,7 +2092,7 @@ Prova a selezionare una parte di terreno più piccola.
Alcuni termini della ricerca sono stati esclusi a causa delle restrizioni di contenuto come esposto negli Standard della comunità.
</notification>
<notification name="NoContentToSearch">
- Seleziona almeno un tipo di contenuto per la ricerca (PG, Mature, o Adult).
+ Seleziona almeno un tipo di contenuto per la ricerca (Generale, Moderato o Adulti).
</notification>
<notification name="GroupVote">
[NAME] ha proposto di votare su:
diff --git a/indra/newview/skins/default/xui/it/panel_group_general.xml b/indra/newview/skins/default/xui/it/panel_group_general.xml
index 08a5153c73..49baa73811 100644
--- a/indra/newview/skins/default/xui/it/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/it/panel_group_general.xml
@@ -46,12 +46,12 @@ Muovi il tuo mouse sopra le opzioni per maggiore aiuto.
<check_box label="Chiunque può aderire" name="open_enrollement" tool_tip="Imposta se questo gruppo permette ai nuovi membri di aderire senza essere invitati."/>
<check_box label="Quota di adesione" name="check_enrollment_fee" tool_tip="Imposta se richiedere una tassa d&apos;iscrizione per aderire al gruppo"/>
<spinner label="L$" left_delta="136" name="spin_enrollment_fee" tool_tip="I nuovi soci devono pagare questa tassa d&apos;iscrizione quando è selezionata." width="60"/>
- <combo_box name="group_mature_check" tool_tip="Imposta se le informazioni sul tuo gruppo sono da considerarsi Mature.">
+ <combo_box name="group_mature_check" tool_tip="Imposta se le informazioni sul tuo gruppo sono da considerarsi di tipo Moderato.">
<combo_item name="select_mature">
- Seleziona categoria di accesso -
</combo_item>
- <combo_box.item label="Contenuto Mature" name="mature"/>
- <combo_box.item label="Contenuto PG" name="pg"/>
+ <combo_box.item label="Contenuti di tipo Moderato" name="mature"/>
+ <combo_box.item label="Contenuti di tipo Generale" name="pg"/>
</combo_box>
<check_box initial_value="true" label="Mostra nella ricerca" name="show_in_group_list" tool_tip="Permetti alle persone di vedere questo gruppo nei risultati della ricerca"/>
</panel>
diff --git a/indra/newview/skins/default/xui/it/panel_landmark_info.xml b/indra/newview/skins/default/xui/it/panel_landmark_info.xml
index 4af59605c1..b4c5ab01bc 100644
--- a/indra/newview/skins/default/xui/it/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/it/panel_landmark_info.xml
@@ -19,7 +19,7 @@
[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
</string>
<button name="back_btn" tool_tip="Indietro"/>
- <text name="title" value="Profilo del posto"/>
+ <text name="title" value="Profilo del luogo"/>
<scroll_container name="place_scroll">
<panel name="scrolling_panel">
<text name="maturity_value" value="sconosciuto"/>
diff --git a/indra/newview/skins/default/xui/it/panel_place_profile.xml b/indra/newview/skins/default/xui/it/panel_place_profile.xml
index 9a38909d47..eace6c89ce 100644
--- a/indra/newview/skins/default/xui/it/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/it/panel_place_profile.xml
@@ -5,7 +5,7 @@
<string name="anyone" value="Chiunque"/>
<string name="available" value="disponibile"/>
<string name="allocated" value="assegnato"/>
- <string name="title_place" value="Profilo del posto"/>
+ <string name="title_place" value="Profilo del luogo"/>
<string name="title_teleport_history" value="Cronologia Teleport"/>
<string name="not_available" value="(non pert.)"/>
<string name="unknown" value="(sconosciuto)"/>
diff --git a/indra/newview/skins/default/xui/it/panel_preferences_general.xml b/indra/newview/skins/default/xui/it/panel_preferences_general.xml
index 6bf857366b..e8c826609c 100644
--- a/indra/newview/skins/default/xui/it/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/it/panel_preferences_general.xml
@@ -20,20 +20,20 @@
(Richiede il riavvio)
</text>
<text name="maturity_desired_prompt">
- Voglio accedere al contenuto di tipo:
+ Voglio accedere ai contenuti di tipo:
</text>
<text name="maturity_desired_textbox"/>
<combo_box name="maturity_desired_combobox">
- <combo_box.item label="PG, Mature e Adult" name="Desired_Adult"/>
- <combo_box.item label="PG e Mature" name="Desired_Mature"/>
- <combo_box.item label="PG" name="Desired_PG"/>
+ <combo_box.item label="Generale, Moderato e Adulti" name="Desired_Adult"/>
+ <combo_box.item label="Generale e Moderato" name="Desired_Mature"/>
+ <combo_box.item label="Generale" name="Desired_PG"/>
</combo_box>
<text name="start_location_textbox">
Luogo di partenza:
</text>
<combo_box name="start_location_combo">
- <combo_box.item label="Ultimo posto visitato" name="MyLastLocation" tool_tip="Vai nell&apos;ultimo posto visitato di default quando fai login."/>
- <combo_box.item label="Casa mia" name="MyHome" tool_tip="Vai a casa di default quando fai login"/>
+ <combo_box.item label="Ultimo luogo visitato" name="MyLastLocation" tool_tip="Vai automaticamente all&apos;ultimo luogo visitato quando effettui l'accesso."/>
+ <combo_box.item label="Casa mia" name="MyHome" tool_tip="Vai automaticamente a casa quando effettui l'accesso"/>
</combo_box>
<check_box initial_value="true" label="Mostra con il login" name="show_location_checkbox"/>
<text name="name_tags_textbox">
diff --git a/indra/newview/skins/default/xui/it/panel_region_general.xml b/indra/newview/skins/default/xui/it/panel_region_general.xml
index 7d8b346c17..6ca5dd878e 100644
--- a/indra/newview/skins/default/xui/it/panel_region_general.xml
+++ b/indra/newview/skins/default/xui/it/panel_region_general.xml
@@ -30,10 +30,10 @@
<text label="Maturità" name="access_text" width="120">
Categoria di accesso:
</text>
- <icons_combo_box label="Mature" left="126" name="access_combo" width="74">
- <icons_combo_box.item label="Adult" name="Adult" value="42"/>
- <icons_combo_box.item label="Mature" name="Mature" value="21"/>
- <icons_combo_box.item label="PG" name="PG" value="13"/>
+ <icons_combo_box label="Moderato" left="126" name="access_combo" width="74">
+ <icons_combo_box.item label="Adulti" name="Adult" value="42"/>
+ <icons_combo_box.item label="Moderato" name="Mature" value="21"/>
+ <icons_combo_box.item label="Generale" name="PG" value="13"/>
</icons_combo_box>
<button label="Applica" name="apply_btn"/>
<button label="Teleport a casa un residente..." name="kick_btn"/>
diff --git a/indra/newview/skins/default/xui/it/panel_region_general_layout.xml b/indra/newview/skins/default/xui/it/panel_region_general_layout.xml
index 232cd0c387..4cf31f4b6e 100644
--- a/indra/newview/skins/default/xui/it/panel_region_general_layout.xml
+++ b/indra/newview/skins/default/xui/it/panel_region_general_layout.xml
@@ -31,7 +31,7 @@
Categoria:
</text>
<combo_box label="Moderato" name="access_combo">
- <combo_box.item label="Adulto" name="Adult"/>
+ <combo_box.item label="Adulti" name="Adult"/>
<combo_box.item label="Moderato" name="Mature"/>
<combo_box.item label="Generale" name="PG"/>
</combo_box>
diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml
index a496d4c8d6..9a6c648c8e 100644
--- a/indra/newview/skins/default/xui/it/strings.xml
+++ b/indra/newview/skins/default/xui/it/strings.xml
@@ -703,13 +703,13 @@
Controllare la tua fotocamera
</string>
<string name="SIM_ACCESS_PG">
- PG
+ Generale
</string>
<string name="SIM_ACCESS_MATURE">
- Mature
+ Moderato
</string>
<string name="SIM_ACCESS_ADULT">
- Adult
+ Adulti
</string>
<string name="SIM_ACCESS_DOWN">
Offline
diff --git a/indra/newview/skins/default/xui/ja/inspect_avatar.xml b/indra/newview/skins/default/xui/ja/inspect_avatar.xml
index aeac0a8328..fb4937242b 100644
--- a/indra/newview/skins/default/xui/ja/inspect_avatar.xml
+++ b/indra/newview/skins/default/xui/ja/inspect_avatar.xml
@@ -20,7 +20,7 @@
<button label="IM" name="im_btn"/>
<button label="プロフィール" name="view_profile_btn"/>
<panel name="moderator_panel">
- <button label="ボイスを無効にする" name="disable_voice"/>
- <button label="ボイスを有効にする" name="enable_voice"/>
+ <button label="ボイスを無効" name="disable_voice"/>
+ <button label="ボイスを有効" name="enable_voice"/>
</panel>
</floater>
diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml
index b4bf1c0ff0..7adc5e3a78 100644
--- a/indra/newview/skins/default/xui/ja/notifications.xml
+++ b/indra/newview/skins/default/xui/ja/notifications.xml
@@ -2662,7 +2662,7 @@ M キーを押して変更します。
住人選択画面に表示された人に「持ち物」からアイテムをドラッグしてください
</notification>
<notification name="AvatarRezNotification">
- アバター名「 [NAME] 」が [TIME] 秒で出現します。
+ アバター「 [NAME] 」が [TIME] 秒で出現します。
</notification>
<global name="UnsupportedCPU">
- あなたの CPU の速度は必須動作環境の条件を満たしていません。
diff --git a/indra/newview/skins/default/xui/nl/floater_tools.xml b/indra/newview/skins/default/xui/nl/floater_tools.xml
index f79d3dbd6b..0f8392428f 100644
--- a/indra/newview/skins/default/xui/nl/floater_tools.xml
+++ b/indra/newview/skins/default/xui/nl/floater_tools.xml
@@ -403,7 +403,7 @@
<text name="glow label">
Gloed
</text>
- <check_box label="Volledige &#10;helderheid" name="checkbox fullbright" bottom_delta="-21"/>
+ <check_box label="Volledige helderheid" name="checkbox fullbright"/>
<text name="tex gen">
Mapping
</text>
diff --git a/indra/newview/skins/default/xui/pl/menu_login.xml b/indra/newview/skins/default/xui/pl/menu_login.xml
index 2673f5c271..ed4937182f 100644
--- a/indra/newview/skins/default/xui/pl/menu_login.xml
+++ b/indra/newview/skins/default/xui/pl/menu_login.xml
@@ -6,6 +6,7 @@
</menu>
<menu label="Pomoc" name="Help">
<menu_item_call label="[SECOND_LIFE]: Pomoc" name="Second Life Help"/>
+ <menu_item_call label="O [APP_NAME]" name="About Second Life"/>
</menu>
<menu label="Debug" name="Debug">
<menu label="Edytuj" name="Edit">
diff --git a/indra/newview/skins/default/xui/pt/floater_god_tools.xml b/indra/newview/skins/default/xui/pt/floater_god_tools.xml
index 91dc034907..8003a35d16 100644
--- a/indra/newview/skins/default/xui/pt/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/pt/floater_god_tools.xml
@@ -2,7 +2,7 @@
<floater name="godtools floater" title="FERRAMENTAS DE DEUS">
<tab_container name="GodTools Tabs">
<panel label="Grade" name="grid">
- <button label="Limpar os cachês de visibilidade do mapa da região." label_selected="Limpar os cachês de visibilidade do mapa da região." name="Flush This Region&apos;s Map Visibility Caches"/>
+ <button label="Limpar os caches de visibilidade do mapa da região." label_selected="Limpar os caches de visibilidade do mapa da região." name="Flush This Region&apos;s Map Visibility Caches"/>
</panel>
<panel label="Região" name="region">
<text name="Region Name:">
@@ -14,7 +14,7 @@
<check_box label="Visível" name="check visible" tool_tip="Ajustar para fazer essa região visível para os não-deuses"/>
<check_box label="Dano" name="check damage" tool_tip="Ajustar para permitir dano nesta região"/>
<check_box label="Bloquear ratreamento do Tráfego" name="block dwell" tool_tip="Configure isto para fazer a região não computar o tráfego."/>
- <check_box label="Bloquear Terraform" name="block terraform" tool_tip="Ajustar para desabilitar as pessoas a terraplanarem seus terrenos"/>
+ <check_box label="Bloquear terraplenagens" name="block terraform" tool_tip="Ajustar para desabilitar as pessoas a terraplanarem seus terrenos"/>
<check_box label="Sandbox" name="is sandbox" tool_tip="Alterar se esta região for uma sandbox."/>
<button label="Nivelar o terreno" label_selected="Nivelar o Terreno" name="Bake Terrain" tool_tip="Salva o terreno atual como padrão."/>
<button label="Reverter Terreno" label_selected="Reverter Terreno" name="Revert Terrain" tool_tip="Substituir o terreno atual pelo padrão."/>
@@ -63,9 +63,9 @@
<button label="Apagar objetos programados do alvo em outras terras" label_selected="Apagar objetos programados do alvo em outras terras" name="Delete Target&apos;s Scripted Objects On Others Land" tool_tip="Apagar todos os objetos programados possuídos pelo alvo nas terras fora do domínio do alvo. Objetos (sem cópia) irão retornar."/>
<button label="Apagar objetos programados do Alvo em qualquer terreno" label_selected="Apagar objetos programados do Alvo em qualquer terreno" name="Delete Target&apos;s Scripted Objects On *Any* Land" tool_tip="Apagar todos os objetos programados do alvo nesta região. Objetos (sem cópia) irão retornar."/>
<button label="Apagar *TODOS* os objetos do alvo" label_selected="Apagar *TODOS* os objetos do alvo" name="Delete *ALL* Of Target&apos;s Objects" tool_tip="Apagar todos os objetos possuídos pelo alvo nesta região. Objetos (sem cópia) objetos irão retornar."/>
- <button label="Pegar os maiores colidentes" label_selected="Pegar os maiores colidentes" name="Get Top Colliders" tool_tip="Pega a lista de objetos que estão experimentando as chamadas mais freqüentes."/>
- <button label="Pegar os scripts principais" label_selected="Pegar os scripts principais" name="Get Top Scripts" tool_tip="Pegar a lista de objetos programados com a maior duração em tempo de execução."/>
- <button label="Informações de Scripts" label_selected="Informações de Scripts" name="Scripts digest" tool_tip="Pega uma lista de todos os scripts e o número de ocorrências de cada um."/>
+ <button label="Principais colidentes" label_selected="Lista dos maiores colidentes" name="Get Top Colliders" tool_tip="Gera a lista de objetos que estão experimentando as chamadas mais frequentes."/>
+ <button label="Principais scripts" label_selected="Lista dos scripts principais" name="Get Top Scripts" tool_tip="Gera a lista de objetos programados com a maior duração em tempo de execução."/>
+ <button label="Dados dos scripts" label_selected="Dados dos scripts" name="Scripts digest" tool_tip="Gera uma lista de todos os scripts e o número de ocorrências de cada um."/>
</panel>
<panel label="Requisição" name="request">
<text name="Destination:">
diff --git a/indra/newview/skins/default/xui/pt/floater_tools.xml b/indra/newview/skins/default/xui/pt/floater_tools.xml
index 958a166dfc..3068880599 100644
--- a/indra/newview/skins/default/xui/pt/floater_tools.xml
+++ b/indra/newview/skins/default/xui/pt/floater_tools.xml
@@ -68,7 +68,7 @@
þ: [COUNT]
</text>
<check_box label="Esticar ambos os lados" name="checkbox uniform"/>
- <check_box initial_value="true" label="Esticar Texturas" name="checkbox stretch textures"/>
+ <check_box initial_value="true" label="Esticar texturas" name="checkbox stretch textures"/>
<check_box initial_value="true" label="Mostrar na grade" name="checkbox snap to grid"/>
<combo_box name="combobox grid mode" tool_tip="Selecione o tipo de régua da grade onde o objeto será colocado">
<combo_box.item label="Grid SL" name="World"/>
@@ -115,7 +115,7 @@
</text>
<button label="Aplicar" label_selected="Aplicar" name="button apply to selection" tool_tip="Modificar a terra selecionada"/>
<text left="134" name="obj_count">
- Objects: [COUNT]
+ Objetos: [COUNT]
</text>
<text left="134" name="prim_count">
Prims: [COUNT]
@@ -183,10 +183,10 @@
<name_box initial_value="Carregando..." name="Group Name Proxy"/>
<button label="Doar" label_selected="Doar" name="button deed" tool_tip="Ao doar este item, o próximo dono terá permissões de próximo dono. Objetos de grupos podem ser doados por um oficial do grupo."/>
<check_box label="Compartilhar" name="checkbox share with group" tool_tip="Permitir que todos os membros do grupo tenhas suas permissões de modificação para este objeto. Faça uma doação para ativar restrições de função."/>
- <text name="label click action" width="220">
+ <text name="label click action">
Clique para:
</text>
- <combo_box name="clickaction" width="192">
+ <combo_box name="clickaction">
<combo_box.item label="Tocar (padrão)" name="Touch/grab(default)"/>
<combo_box.item label="Sentar no objeto" name="Sitonobject"/>
<combo_box.item label="Comprar objeto" name="Buyobject"/>
diff --git a/indra/newview/skins/default/xui/pt/menu_inventory.xml b/indra/newview/skins/default/xui/pt/menu_inventory.xml
index e3c12e8b7d..345534261a 100644
--- a/indra/newview/skins/default/xui/pt/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inventory.xml
@@ -49,6 +49,8 @@
<menu_item_call label="Abrir" name="Sound Open"/>
<menu_item_call label="Substituir equipamento" name="Replace Outfit"/>
<menu_item_call label="Adicionar ao equipamento" name="Add To Outfit"/>
+ <menu_item_call label="Tirar do look atual" name="Remove From Outfit"/>
+ <menu_item_call label="Encontrar original" name="Find Original"/>
<menu_item_call label="Remover item" name="Purge Item"/>
<menu_item_call label="Restaurar item" name="Restore Item"/>
<menu_item_call label="Abrir" name="Open"/>
@@ -58,6 +60,7 @@
<menu_item_call label="Copiar" name="Copy"/>
<menu_item_call label="Colar" name="Paste"/>
<menu_item_call label="Colar como link" name="Paste As Link"/>
+ <menu_item_call label="Remover link" name="Remove Link"/>
<menu_item_call label="Apagar" name="Delete"/>
<menu_item_call label="Excluir pasta do sistema" name="Delete System Folder"/>
<menu_item_call label="Pasta conversa em conferência" name="Conference Chat Folder"/>
diff --git a/indra/newview/skins/default/xui/pt/menu_login.xml b/indra/newview/skins/default/xui/pt/menu_login.xml
index a7df67a6b5..8ea87a06d1 100644
--- a/indra/newview/skins/default/xui/pt/menu_login.xml
+++ b/indra/newview/skins/default/xui/pt/menu_login.xml
@@ -6,6 +6,7 @@
</menu>
<menu label="Ajuda" name="Help">
<menu_item_call label="Ajuda do [SECOND_LIFE]" name="Second Life Help"/>
+ <menu_item_call label="Sobre [APP_NAME]" name="About Second Life"/>
</menu>
<menu_item_check label="Exibir menu de depuração" name="Show Debug Menu"/>
<menu label="Depurar" name="Debug">
diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml
index 039c6b334c..462dcf2b21 100644
--- a/indra/newview/skins/default/xui/pt/notifications.xml
+++ b/indra/newview/skins/default/xui/pt/notifications.xml
@@ -199,7 +199,7 @@ Convite outros membros dentro de 48 horas.
Por favor, selecione um indivíduo para realizar a venda se o valor for 0 L$.
</notification>
<notification name="ConfirmLandSaleChange">
- [LAND_SIZE] m² selecionados de terra estão sendo configurados para venda.
+ [LAND_SIZE] m² selecionados de terreno estão sendo configurados para venda.
Seu preço de venda será L$[SALE_PRICE] e está autorizado para venda para [NAME]. Gostaria de continuar a fazer essa alteração?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Continuar"/>
</notification>
@@ -211,24 +211,24 @@ O preço será L$[SALE_PRICE] e [NAME] pode comprar o terreno.
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
</notification>
<notification name="ReturnObjectsDeededToGroup">
- Você tem certeza de que quer retornar todos os objetos compartilhados com o grupo &apos;[NAME]&apos; neste lote de terra, para o inventário do seu antigo Proprietário?
+ Tem certeza de que quer devolver todos os objetos compartilhados com o grupo &apos;[NAME]&apos; neste lote, para o inventário do seu antigo Proprietário?
*AVISO* Isso irá deletar os objetos não transferíveis doados ao grupo!
Objetos: [N]
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
</notification>
<notification name="ReturnObjectsOwnedByUser">
- Você tem certeza de que deseja retornar todos os objetos do residente &apos;[NAME]&apos; neste lote para o inventário dele?
+ Você tem certeza de que deseja devolver todos os objetos do residente &apos;[NAME]&apos; neste lote para o inventário dele?
Objetos: [N]
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
</notification>
<notification name="ReturnObjectsOwnedBySelf">
Você tem certeza de que deseja retornar todos os objetos de sua propriedade neste lote para seu inventário?
Objetos: [N]
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
</notification>
<notification name="ReturnObjectsNotOwnedBySelf">
Você tem certeza de que deseja retornar todos os objetos que NÃO são seus para o inventário de seus proprietários?
@@ -237,7 +237,7 @@ Objetos transferíveis doados ao grupo retornarão para seu proprietários.
*AVISO* Isso fará com que os objetos não-transferíveis sejam deletados!
Objetos: [N]
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
</notification>
<notification name="ReturnObjectsNotOwnedByUser">
Você tem certeza de que deseja retornar todos os objetos deste lote NÃO pertencentes a [NAME] para o inventário do proprietário?
@@ -245,11 +245,11 @@ Objetos: [N]
*AVISO* Esta ação irá apagar os objetos não transferíveis doados ao grupo!
Objetos: [N]
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
</notification>
<notification name="ReturnAllTopObjects">
Você tem certeza de que deseja enviar todos os objetos listados de volta aos inventários de seus proprietários?
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
</notification>
<notification name="DisableAllTopObjects">
Você tem certeza que deseja desativar todos os objetos desta região?
@@ -259,10 +259,10 @@ Objetos: [N]
Retornar os objetos deste lote que NÃO são compartilhados com o grupo [NAME] de volta para seus proprietários?
Objetos: [N]
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
</notification>
<notification name="UnableToDisableOutsideScripts">
- Não é possível desabilitar scripts externos.
+ Não é possível desativar scripts externos.
Toda esta região possui dano habilitado.
Scripts devem ser permitidos para fazer as armas funcionarem.
</notification>
@@ -301,7 +301,7 @@ Para colocar a mídia em só uma face, selecione Selecionar face e clique na fac
Você deve concordar com os Termos de Serviço para continuar a entrar no [SECOND_LIFE].
</notification>
<notification name="CouldNotPutOnOutfit">
- Não foi possível vestir o conjunto. A pasta do conjunto não contém roupas, partes do corpo ou acessórios.
+ Não foi possível vestir o look. A pasta do look não contém roupas, partes do corpo ou acessórios.
</notification>
<notification name="CannotWearTrash">
Não é possível usar roupas ou partes do corpo que estão no lixo.
@@ -311,17 +311,17 @@ Para colocar a mídia em só uma face, selecione Selecionar face e clique na fac
Ele ultrapassa o limite de anexos, de [MAX_ATTACHMENTS] objetos. Remova um objeto para poder anexar outro.
</notification>
<notification name="CannotWearInfoNotComplete">
- Você não pode vestir este item porque ele ainda não carregou. Por favor, tente novamente em um minuto.
+ Você não pode vestir este item porque ele ainda não carregou. Tente novamente em um minuto.
</notification>
<notification name="MustHaveAccountToLogIn">
Oops! Alguma coisa foi deixada em branco.
Você precisa entrar com ambos os Nome e Sobrenome do seu avatar.
-Você precisa de uma conta para entrar no [SECOND_LIFE]. Você gostaria de criar uma conta agora?
+Você precisa de uma conta para entrar no [SECOND_LIFE]. Você gostaria de abrir uma conta agora?
<url name="url">
https://join.secondlife.com/index.php?lang=pt-BR
</url>
- <usetemplate name="okcancelbuttons" notext="Tentar novamente" yestext="Criar uma nova conta"/>
+ <usetemplate name="okcancelbuttons" notext="Tentar novamente" yestext="Abrir conta"/>
</notification>
<notification name="AddClassified">
Os anúncios serão publicados na seção &apos;Classificados&apos; das buscas e em [http://secondlife.com/community/classifieds secondlife.com] durante uma semana.
@@ -350,7 +350,7 @@ Tem certeza de que quer prosseguir?
</notification>
<notification name="DeleteAvatarPick">
Excluir destaque &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Delete"/>
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Apagar"/>
</notification>
<notification name="PromptGoToEventsPage">
Ir até a página web de enventos [SECOND_LIFE] ?
@@ -360,10 +360,10 @@ Tem certeza de que quer prosseguir?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Ir à página"/>
</notification>
<notification name="SelectProposalToView">
- Por favor, selecione uma proposta para visualizar.
+ Selecione uma proposta para visualizar.
</notification>
<notification name="SelectHistoryItemToView">
- Por favor, selecione um item do histórico para exibí-lo.
+ Selecione um item do histórico para exibi-lo.
</notification>
<notification name="CacheWillClear">
O cache será limpo quando o [APP_NAME] for iniciado.
@@ -406,7 +406,7 @@ O objeto pode estar fora de alcance ou foi deletado.
O objeto pode estar fora de alcance ou foi deletado.
</notification>
<notification name="SaveNotecardFailReason">
- Houve um problema em salvar uma nota devido a seguinte razão: [REASON]. Por favor, tente salvar a nota novamente mais tarde.
+ Houve um problema em salvar uma nota devido a seguinte razão: [REASON]. Tente salvar a nota novamente mais tarde.
</notification>
<notification name="ScriptCannotUndo">
Não foi possível desfazer todas as mudanças na sua versão de script.
@@ -415,7 +415,7 @@ Gostaria de carregar a última versão salva?
<usetemplate name="okcancelbuttons" notext="Não" yestext="Sim"/>
</notification>
<notification name="SaveScriptFailReason">
- Houve um problema em salvar um script devido à seguinte razão: [REASON]. Por favor, tente salvar novamente o script mais tarde.
+ Houve um problema em salvar um script devido à seguinte razão: [REASON]. Tente salvar novamente o script mais tarde.
</notification>
<notification name="SaveScriptFailObjectNotFound">
Não foi possível salvar o script pois o objeto em que ele está não pôde ser encontrado.
@@ -500,15 +500,15 @@ Ele ou ela vai ficar temporariamente incapaz de se mover, usar o bate-papo ou in
<usetemplate canceltext="Cancelar" name="yesnocancelbuttons" notext="Descongelar" yestext="Congelar"/>
</notification>
<notification name="EjectAvatarFullname">
- Ejetar [AVATAR_NAME] da sua terra?
+ Ejetar [AVATAR_NAME] do seu terreno?
<usetemplate canceltext="Cancelar" name="yesnocancelbuttons" notext="Ejetar e Banir" yestext="Ejetar"/>
</notification>
<notification name="EjectAvatarNoBan">
- Ejetar este avatar da sua terra?
+ Ejetar este avatar do seu terreno?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Ejetar"/>
</notification>
<notification name="EjectAvatarFullnameNoBan">
- Ejetar [AVATAR_NAME] da sua terra?
+ Ejetar [AVATAR_NAME] do seu terreno?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Ejetar"/>
</notification>
<notification name="EjectAvatarFromGroup">
@@ -519,7 +519,7 @@ Ele ou ela vai ficar temporariamente incapaz de se mover, usar o bate-papo ou in
</notification>
<notification name="AcquireErrorObjectSpan">
Erro de aquisição: Objetos criados em mais de uma região.
-Por favor, mova todos os objetos a serem adquiridos para uma mesma região.
+Mova todos os objetos a serem adquiridos para uma mesma região.
</notification>
<notification name="PromptGoToCurrencyPage">
[EXTRA]
@@ -766,29 +766,29 @@ Nenhum grupo selecionado.
A região do terreno não pôde ser localizada.
</notification>
<notification name="CannotDeedLandMultipleSelected">
- Impossibilitado de passar a propriedade da terra:
-Selecionados vários lotes.
+ Não é possível doar o terreno:
+Vários lotes foram selecionados.
Tente selecionar um único lote.
</notification>
<notification name="CannotDeedLandWaitingForServer">
- Impossibilitado de passar a propriedade da terra:
-Esperando pelo servidor informar de quem é a propriedade.
+ Não é possível doar o terreno:
+Esperando o servidor informar de quem é a propriedade.
Por favor, tente novamente.
</notification>
<notification name="CannotDeedLandNoTransfer">
- Não é possível transferir posse do terreno:
-A região [REGION] não permite transferência do terreno.
+ Não é possível doar o terreno:
+A região [REGION] não permite transferências de terreno.
</notification>
<notification name="CannotReleaseLandWatingForServer">
- Impossibilitado de abandonar a terra:
+ Não é possível abandonar o terreno:
Esperando o servidor atualizar as informações do lote.
Tente novamente em alguns segundos.
</notification>
<notification name="CannotReleaseLandSelected">
- Impossibilitado de abandonar a terra:
+ Não é possível abandonar o terreno:
Você não é dono de todos os lotes selecionados.
Por favor, selecione um único lote.
@@ -807,25 +807,25 @@ A região do terreno não pôde ser localizada.
A região [REGION] não permite transferência de terreno.
</notification>
<notification name="CannotReleaseLandPartialSelection">
- Impossibilitado de abandonar a terra:
-Você deve selecionar um lote inteiro para liberá-lo.
+ Não é possível abandonar o terreno:
+Selecione um lote inteiro e abra mão dele.
Selecione um lote inteiro ou primeiro divida seu lote.
</notification>
<notification name="ReleaseLandWarning">
- Você está para liberar [AREA] m² de terra.
-Liberando este terreno, o liberará de suas posses, mas não lhe concederá quaisquer L$.
+ Você está prestes a abrir mão de [AREA] m².
+Ao abrir mão deste terreno, ele deixa de ser uma propriedade. Note que você não receberá nenhum L$.
-Liberar esta terra?
+Abrir mão deste terreno?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Renunciar"/>
</notification>
<notification name="CannotDivideLandNothingSelected">
- Impossibilitado de dividir a terra:
+ Não é possível dividir o terreno:
-Nenhum lote selecionado.
+Nenhum lote foi selecionado.
</notification>
<notification name="CannotDivideLandPartialSelection">
- Impossibilitado de dividir a terra:
+ Não é possível dividir o terreno:
Você selecionou um lote inteiro.
Tente selecionar uma parte do lote.
@@ -841,34 +841,34 @@ Quer dividir o terreno?
A região do terreno não pôde ser localizada.
</notification>
<notification name="CannotJoinLandNoRegion">
- Houve um problema ao processar a junção dos terrenos:
+ Houve um problema ao processar a união dos terrenos:
A região do terreno não pôde ser localizada.
</notification>
<notification name="CannotJoinLandNothingSelected">
- Não é possível unir terreno:
+ Não é possível unir os terrenos:
Nenhum lote selecionado.
</notification>
<notification name="CannotJoinLandEntireParcelSelected">
- Impossibilitado de unir a terra:
+ Não é possível unir os terrenos:
Você selecionou apenas um lote.
Selecione a terra através de ambos os lotes.
</notification>
<notification name="CannotJoinLandSelection">
- Impossibilitado de unir a terra:
+ Não é possível unir os terrenos:
Você deve selecionar mais de um lote.
-Selecione a terra através de ambos os lotes.
+Selecione terrenos localizados em dois lotes.
</notification>
<notification name="JoinLandWarning">
- Unir esta terra vai criar um grande lote que envolve todos os lotes que intersectam o retângulo selecionado.
+ Unir os terrenos vai criar um grande lote, formado por todos os lotes que intersectam o retângulo selecionado.
Você vai ter que redefinir nome e as opções do novo lote.
-Unir a terra?
+Unir os terrenos?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Unir"/>
</notification>
<notification name="ConfirmNotecardSave">
- Esta nota precisa ser salva antes do item ser copiado ou visualizado. Salvar nota?
+ Esta anotação precisa ser salva antes de o item ser copiado ou visualizado. Salvar anotação?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Salvar"/>
</notification>
<notification name="ConfirmItemCopy">
@@ -1027,24 +1027,23 @@ Tem certeza de que deseja pegar estes itens?
<usetemplate name="okcancelbuttons" notext="Não" yestext="Sim"/>
</notification>
<notification name="CantBuyLandAcrossMultipleRegions">
- Não foi possível comprar terreno, pois a seleção abrange várias regiões.
+ Não foi possível comprar o terreno, pois a seleção abrange várias regiões.
Por favor, selecione uma área menor e tente novamente.
</notification>
<notification name="DeedLandToGroup">
- Na transferência de propriedade deste lote, o grupo deverá ter e manter créditos suficientes de uso da terra.
-O preço de aquisição dos terrenos não é restituído ao o proprietário. Se uma parcela transferida é vendida, o preço de venda é dividido igualmente entre os membros do grupo.
+ No ato da doação deste lote, o grupo deverá ter e manter créditos suficientes para ter o terreno.
+O preço de aquisição dos terrenos não é restituído ao proprietário. Se uma parcela doada for vendida, o preço de venda é dividido igualmente entre os membros do grupo.
-Transferir propriedade de [AREA] m² de terra ao grupo &apos;[GROUP_NAME]&apos;?
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Acionar"/>
+Doar [AREA] m² ao grupo &apos;[GROUP_NAME]&apos;?
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
</notification>
<notification name="DeedLandToGroupWithContribution">
- Na transferência de propriedade deste lote, o grupo deverá ter e manter créditos suficientes de uso da terra.
-A Transferência incluirá uma contribuição de terra simultanea para o grupo de &apos;[FIRST_NAME] [LAST_NAME]&apos;.
-O preço da compra não será restituído ao proprietário. Se um lote for vendido, o preço da venda será dividido igualmente entre os membros do grupo.
+ No ato da doação deste lote, o grupo deverá ter e manter créditos suficientes para ter o terreno. A doação inclui uma contribuição simultânea para o grupo de &apos;[FIRST_NAME] [LAST_NAME]&apos;.
+O preço de aquisição dos terrenos não é restituído ao proprietário. Se uma parcela doada for vendida, o preço de venda é dividido igualmente entre os membros do grupo.
-Transferir propriedade destes [AREA] m² de terreno para o grupo &apos;[GROUP_NAME]&apos;?
- <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Acionar"/>
+Doar [AREA] m² para o grupo &apos;[GROUP_NAME]&apos;?
+ <usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
</notification>
<notification name="DisplaySetToSafe">
Configurações de display foram ajustadas para níveis de segurança porque você especificou -- opção de segurança.
diff --git a/indra/newview/skins/default/xui/pt/panel_people.xml b/indra/newview/skins/default/xui/pt/panel_people.xml
index 0b274d6faa..17f5b6cbac 100644
--- a/indra/newview/skins/default/xui/pt/panel_people.xml
+++ b/indra/newview/skins/default/xui/pt/panel_people.xml
@@ -52,11 +52,11 @@ Em busca de alguém para conversar? Procure no [secondlife:///app/worldmap Mapa-
</panel>
</tab_container>
<panel name="button_bar">
- <button label="Perfil" name="view_profile_btn" tool_tip="Exibir fotografia, grupos e outras informações dos residentes"/>
- <button label="MI" name="im_btn" tool_tip="Iniciar MI"/>
- <button label="Chamada" name="call_btn" tool_tip="Ligar para este residente"/>
- <button label="Compartilhar" name="share_btn"/>
- <button label="Teletransporte" name="teleport_btn" tool_tip="Oferecer teletransporte"/>
+ <button label="Perfil" name="view_profile_btn" tool_tip="Exibir fotografia, grupos e outras informações dos residentes" width="50"/>
+ <button label="MI" name="im_btn" tool_tip="Iniciar MI" width="24"/>
+ <button label="Chamada" name="call_btn" tool_tip="Ligar para este residente" width="61"/>
+ <button label="Compartilhar" name="share_btn" width="82"/>
+ <button label="Teletransporte" name="teleport_btn" tool_tip="Oferecer teletransporte" width="86"/>
<button label="Perfil do grupo" name="group_info_btn" tool_tip="Exibir informação de grupo"/>
<button label="Bate-papo de grupo" name="chat_btn" tool_tip="Iniciar bate-papo"/>
<button label="Ligar para o grupo" name="group_call_btn" tool_tip="Ligar para este grupo"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_region_debug.xml b/indra/newview/skins/default/xui/pt/panel_region_debug.xml
index 2119a06e55..f2cc9f644d 100644
--- a/indra/newview/skins/default/xui/pt/panel_region_debug.xml
+++ b/indra/newview/skins/default/xui/pt/panel_region_debug.xml
@@ -6,15 +6,15 @@
<text name="region_text">
desconhecido
</text>
- <check_box label="Desabilitar Scripts" name="disable_scripts_check" tool_tip="Desabilitar todos os scripts nesta região"/>
+ <check_box label="Desativar scripts" name="disable_scripts_check" tool_tip="Desativar todos os scripts nesta região"/>
<button label="?" name="disable_scripts_help"/>
- <check_box label="Desabilitar colisões" name="disable_collisions_check" tool_tip="Desabilitar colisões de não-avatares nessa região"/>
+ <check_box label="Desativar colisões" name="disable_collisions_check" tool_tip="Desabilitar colisões de não-avatares nessa região"/>
<button label="?" name="disable_collisions_help"/>
- <check_box label="Desabilitar física" name="disable_physics_check" tool_tip="Desabilitar toda a físíca nesta região"/>
+ <check_box label="Desativar física" name="disable_physics_check" tool_tip="Desativar toda a físíca nesta região"/>
<button label="?" name="disable_physics_help"/>
<button label="Aplicar" name="apply_btn"/>
<text name="objret_text_lbl" width="130">
- Retornar objeto
+ Devolver objeto
</text>
<text name="resident_text_lbl">
Residente:
@@ -27,14 +27,14 @@
Opções:
</text>
<check_box label="Com scripts" name="return_scripts" tool_tip="Só devolver objetos com scripts"/>
- <check_box label="No terreno de outra pessoa" name="return_other_land" tool_tip="Retornar apenas objetos que estejam na terra pertencente a alguém"/>
- <check_box label="Em todas as regiões desta propriedade" name="return_estate_wide" tool_tip="Retornar objetos em todas as regiões que constituem esta propriedade"/>
- <button label="Retornar" name="return_btn"/>
- <button label="Pegar os principais colidentes..." name="top_colliders_btn" tool_tip="Lista dos objetos que experimentam as mais potenciais colisões" width="280"/>
+ <check_box label="No terreno de outra pessoa" name="return_other_land" tool_tip="Devolver apenas objetos que estejam em terrenos de outra pessoa"/>
+ <check_box label="Em todas as regiões desta propriedade" name="return_estate_wide" tool_tip="Devolver objetos em todas as regiões que constituem esta propriedade"/>
+ <button label="Devolver" name="return_btn"/>
+ <button label="Principais colidentes..." name="top_colliders_btn" tool_tip="Lista dos objetos com maior potencial de colisão" width="280"/>
<button label="?" left="297" name="top_colliders_help"/>
- <button label="Pegar Principais Scripts..." name="top_scripts_btn" tool_tip="Lista de objetos gastando mais tempo rodando scripts" width="280"/>
+ <button label="Principais scripts..." name="top_scripts_btn" tool_tip="Lista de objetos que mais passam tempo executando scripts" width="280"/>
<button label="?" left="297" name="top_scripts_help"/>
- <button label="Reiniciar a Região" name="restart_btn" tool_tip="Dar 2 minutos de contagem regressiva e reiniciar a região"/>
+ <button label="Reiniciar a região" name="restart_btn" tool_tip="Após 2 minutos de contagem regressiva, reiniciar a região"/>
<button label="?" name="restart_help"/>
- <button label="Atrasar o Reinicio" name="cancel_restart_btn" tool_tip="Atrasar o reinicio da região por uma hora"/>
+ <button label="Adiar reinício" name="cancel_restart_btn" tool_tip="Adiar o reinício da região por uma hora"/>
</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_region_general_layout.xml b/indra/newview/skins/default/xui/pt/panel_region_general_layout.xml
index d2d5fb649c..534b2826af 100644
--- a/indra/newview/skins/default/xui/pt/panel_region_general_layout.xml
+++ b/indra/newview/skins/default/xui/pt/panel_region_general_layout.xml
@@ -18,12 +18,12 @@
<text name="region_type">
(Desconhecido)
</text>
- <check_box label="Bloquear terraplanagem" name="block_terraform_check"/>
+ <check_box label="Bloquear terraplanagens" name="block_terraform_check"/>
<check_box label="Bloquear voos" name="block_fly_check"/>
<check_box label="Permitir danos" name="allow_damage_check"/>
<check_box label="Limitar empurrões" name="restrict_pushobject"/>
<check_box label="Permitir revenda de terrenos" name="allow_land_resell_check"/>
- <check_box label="Permitir junção e divisão de terrenos" name="allow_parcel_changes_check"/>
+ <check_box label="Permitir união e divisão de terrenos" name="allow_parcel_changes_check"/>
<check_box label="Não mostrar nos resultados de pesquisa" name="block_parcel_search_check" tool_tip="Mostrar esta região e lotes nos resultados de pesquisa"/>
<spinner label="Limite do agente" name="agent_limit_spin"/>
<spinner label="Bônus do objeto" name="object_bonus_spin"/>
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index ef93586c6e..1c29feec5f 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -10,7 +10,10 @@
// Precompiled header
#include "../llviewerprecompiledheaders.h"
// Own header
+#include "../llsecapi.h"
+#include "../llviewernetwork.h"
#include "../lllogininstance.h"
+
// STL headers
// std headers
// external library headers
@@ -33,7 +36,12 @@ const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno");
//-----------------------------------------------------------------------------
static LLEventStream gTestPump("test_pump");
+#include "../llslurl.h"
+#include "../llstartup.h"
+LLSLURL LLStartUp::sStartSLURL;
+
#include "lllogin.h"
+
static std::string gLoginURI;
static LLSD gLoginCreds;
static bool gDisconnectCalled = false;
@@ -54,17 +62,75 @@ void LLLogin::disconnect()
gDisconnectCalled = true;
}
+LLSD LLCredential::getLoginParams()
+{
+ LLSD result = LLSD::emptyMap();
+
+ // legacy credential
+ result["passwd"] = "$1$testpasssd";
+ result["first"] = "myfirst";
+ result["last"] ="mylast";
+ return result;
+}
+void LLCredential::identifierType(std::string &idType)
+{
+}
+
+void LLCredential::authenticatorType(std::string &idType)
+{
+}
+
//-----------------------------------------------------------------------------
#include "../llviewernetwork.h"
-unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {'1','2','3','4','5','6'};
+LLGridManager::~LLGridManager()
+{
+}
+
+void LLGridManager::addGrid(LLSD& grid_data)
+{
+}
+LLGridManager::LLGridManager()
+{
+}
-LLViewerLogin::LLViewerLogin() : mGridChoice(GRID_INFO_NONE) {}
-LLViewerLogin::~LLViewerLogin() {}
-void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const
+void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
{
uris.push_back(VIEWERLOGIN_URI);
}
-std::string LLViewerLogin::getGridLabel() const { return VIEWERLOGIN_GRIDLABEL; }
+
+void LLGridManager::addSystemGrid(const std::string& label,
+ const std::string& name,
+ const std::string& login,
+ const std::string& helper,
+ const std::string& login_page,
+ const std::string& login_id)
+{
+}
+std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
+{
+ std::map<std::string, std::string> result;
+ return result;
+}
+
+void LLGridManager::setGridChoice(const std::string& grid_name)
+{
+}
+
+bool LLGridManager::isInProductionGrid()
+{
+ return false;
+}
+
+void LLGridManager::saveFavorites()
+{}
+std::string LLGridManager::getSLURLBase(const std::string& grid_name)
+{
+ return "myslurl";
+}
+std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
+{
+ return "myappslurl";
+}
//-----------------------------------------------------------------------------
#include "../llviewercontrol.h"
@@ -86,10 +152,6 @@ BOOL LLControlGroup::declareString(const std::string& name, const std::string &i
#include "lluicolortable.h"
void LLUIColorTable::saveUserSettings(void)const {}
-//-----------------------------------------------------------------------------
-#include "../llurlsimstring.h"
-LLURLSimString LLURLSimString::sInstance;
-bool LLURLSimString::parse() { return true; }
//-----------------------------------------------------------------------------
#include "llnotifications.h"
@@ -197,15 +259,29 @@ namespace tut
gSavedSettings.declareString("NextLoginLocation", "", "", FALSE);
gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", FALSE);
- credentials["first"] = "testfirst";
- credentials["last"] = "testlast";
- credentials["passwd"] = "testpass";
+ LLSD authenticator = LLSD::emptyMap();
+ LLSD identifier = LLSD::emptyMap();
+ identifier["type"] = "agent";
+ identifier["first_name"] = "testfirst";
+ identifier["last_name"] = "testlast";
+ authenticator["passwd"] = "testpass";
+ agentCredential = new LLCredential();
+ agentCredential->setCredentialData(identifier, authenticator);
+
+ authenticator = LLSD::emptyMap();
+ identifier = LLSD::emptyMap();
+ identifier["type"] = "account";
+ identifier["username"] = "testuser";
+ authenticator["secret"] = "testsecret";
+ accountCredential = new LLCredential();
+ accountCredential->setCredentialData(identifier, authenticator);
logininstance->setNotificationsInterface(&notifications);
}
LLLoginInstance* logininstance;
- LLSD credentials;
+ LLPointer<LLCredential> agentCredential;
+ LLPointer<LLCredential> accountCredential;
MockNotifications notifications;
};
@@ -219,7 +295,7 @@ namespace tut
set_test_name("Test Simple Success And Disconnect");
// Test default connect.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -260,7 +336,7 @@ namespace tut
const std::string test_uri = "testing-uri";
// Test default connect.
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
// connect should call LLLogin::connect to init gLoginURI and gLoginCreds.
ensure_equals("Default connect uri", gLoginURI, "testing-uri");
@@ -282,7 +358,7 @@ namespace tut
ensure("No TOS, failed auth", logininstance->authFailure());
// Start again.
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
gTestPump.post(response); // Fail for tos again.
gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos.
ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true);
@@ -294,11 +370,11 @@ namespace tut
gTestPump.post(response);
ensure("TOS auth failure", logininstance->authFailure());
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
// Critical Message failure response.
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
response["data"]["reason"] = "critical"; // Change response to "critical message"
gTestPump.post(response);
@@ -312,7 +388,7 @@ namespace tut
response["data"]["reason"] = "key"; // bad creds.
gTestPump.post(response);
ensure("TOS auth failure", logininstance->authFailure());
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false);
}
@@ -323,7 +399,7 @@ namespace tut
// Part 1 - Mandatory Update, with User accepts response.
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -349,7 +425,7 @@ namespace tut
set_test_name("Test Mandatory Update User Decline");
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -375,7 +451,7 @@ namespace tut
// Part 3 - Mandatory Update, with bogus response.
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -401,7 +477,7 @@ namespace tut
// Part 3 - Mandatory Update, with bogus response.
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp
new file mode 100644
index 0000000000..caa1461987
--- /dev/null
+++ b/indra/newview/tests/llsecapi_test.cpp
@@ -0,0 +1,188 @@
+/**
+ * @file llsecapi_test.cpp
+ * @author Roxie
+ * @date 2009-02-10
+ * @brief Test the sec api functionality
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden LregisterSecAPIab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../llviewernetwork.h"
+#include "../test/lltut.h"
+#include "../llsecapi.h"
+#include "../../llxml/llcontrol.h"
+
+
+//----------------------------------------------------------------------------
+// Mock objects for the dependencies of the code we're testing
+
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+ const std::string& initial_val,
+ const std::string& comment,
+ BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+std::string LLControlGroup::getString(const std::string& name)
+{
+ return "";
+}
+
+
+LLControlGroup gSavedSettings("test");
+class LLSecAPIBasicHandler : public LLSecAPIHandler
+{
+protected:
+ LLPointer<LLCertificateChain> mCertChain;
+ LLPointer<LLCertificate> mCert;
+ LLPointer<LLCertificateStore> mCertStore;
+ LLSD mLLSD;
+
+public:
+ LLSecAPIBasicHandler() {}
+
+ virtual ~LLSecAPIBasicHandler() {}
+
+ // instantiate a certificate from a pem string
+ virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert)
+ {
+ return mCert;
+ }
+
+
+ // instiate a certificate from an openssl X509 structure
+ virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert)
+ {
+ return mCert;
+ }
+
+
+ // instantiate a chain from an X509_STORE_CTX
+ virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain)
+ {
+ return mCertChain;
+ }
+
+ // instantiate a cert store given it's id. if a persisted version
+ // exists, it'll be loaded. If not, one will be created (but not
+ // persisted)
+ virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id)
+ {
+ return mCertStore;
+ }
+
+ // persist data in a protected store
+ virtual void setProtectedData(const std::string& data_type,
+ const std::string& data_id,
+ const LLSD& data) {}
+
+ // retrieve protected data
+ virtual LLSD getProtectedData(const std::string& data_type,
+ const std::string& data_id)
+ {
+ return mLLSD;
+ }
+
+ virtual void deleteProtectedData(const std::string& data_type,
+ const std::string& data_id)
+ {
+ }
+
+ virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+ const LLSD& identifier,
+ const LLSD& authenticator)
+ {
+ LLPointer<LLCredential> cred = NULL;
+ return cred;
+ }
+
+ virtual LLPointer<LLCredential> loadCredential(const std::string& grid)
+ {
+ LLPointer<LLCredential> cred = NULL;
+ return cred;
+ }
+
+ virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator) {}
+
+ virtual void deleteCredential(LLPointer<LLCredential> cred) {}
+};
+
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+ // Test wrapper declaration : wrapping nothing for the moment
+ struct secapiTest
+ {
+
+ secapiTest()
+ {
+ }
+ ~secapiTest()
+ {
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<secapiTest> secapiTestFactory;
+ typedef secapiTestFactory::object secapiTestObject;
+ tut::secapiTestFactory tut_test("llsecapi");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // registration
+ template<> template<>
+ void secapiTestObject::test<1>()
+ {
+ // retrieve an unknown handler
+
+ ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ LLPointer<LLSecAPIHandler> test1_handler = new LLSecAPIBasicHandler();
+ registerSecHandler("sectest1", test1_handler);
+ ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ LLPointer<LLSecAPIHandler> retrieved_test1_handler = getSecHandler("sectest1");
+ ensure("Retrieved sectest1 handler should be the same",
+ retrieved_test1_handler == test1_handler);
+
+ // insert a second handler
+ LLPointer<LLSecAPIHandler> test2_handler = new LLSecAPIBasicHandler();
+ registerSecHandler("sectest2", test2_handler);
+ ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ retrieved_test1_handler = getSecHandler("sectest1");
+ ensure("Retrieved sectest1 handler should be the same",
+ retrieved_test1_handler == test1_handler);
+
+ LLPointer<LLSecAPIHandler> retrieved_test2_handler = getSecHandler("sectest2");
+ ensure("Retrieved sectest1 handler should be the same",
+ retrieved_test2_handler == test2_handler);
+
+ }
+}
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
new file mode 100644
index 0000000000..fd680b24f0
--- /dev/null
+++ b/indra/newview/tests/llsechandler_basic_test.cpp
@@ -0,0 +1,1051 @@
+/**
+ * @file llsechandler_basic_test.cpp
+ * @author Roxie
+ * @date 2009-02-10
+ * @brief Test the 'basic' sec handler functions
+ *
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ *
+ * Copyright (c) 2005-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../test/lltut.h"
+#include "../llsecapi.h"
+#include "../llsechandler_basic.h"
+#include "../../llxml/llcontrol.h"
+#include "../llviewernetwork.h"
+#include "lluuid.h"
+#include "llxorcipher.h"
+#include "apr_base64.h"
+#include <vector>
+#include <ios>
+#include <llsdserialize.h>
+#include <openssl/pem.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+#include "llxorcipher.h"
+#include <openssl/ossl_typ.h>
+#include <openssl/x509.h>
+#include <openssl/x509v3.h>
+#include <openssl/pem.h>
+#include <openssl/asn1.h>
+#include <openssl/rand.h>
+#include <openssl/err.h>
+
+
+#define ensure_throws(str, exc_type, cert, func, ...) \
+try \
+{ \
+func(__VA_ARGS__); \
+fail("throws, " str); \
+} \
+catch(exc_type& except) \
+{ \
+ensure("Exception cert is incorrect for " str, except.getCert() == cert); \
+}
+
+extern bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& wildcard_string);
+
+//----------------------------------------------------------------------------
+// Mock objects for the dependencies of the code we're testing
+
+std::string gFirstName;
+std::string gLastName;
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+ const std::string& initial_val,
+ const std::string& comment,
+ BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+std::string LLControlGroup::getString(const std::string& name)
+{
+
+ if (name == "FirstName")
+ return gFirstName;
+ else if (name == "LastName")
+ return gLastName;
+ return "";
+}
+
+LLSD LLCredential::getLoginParams()
+{
+ LLSD result = LLSD::emptyMap();
+
+ // legacy credential
+ result["passwd"] = "$1$testpasssd";
+ result["first"] = "myfirst";
+ result["last"] ="mylast";
+ return result;
+}
+
+void LLCredential::identifierType(std::string &idType)
+{
+}
+
+void LLCredential::authenticatorType(std::string &idType)
+{
+}
+
+
+LLControlGroup gSavedSettings("test");
+unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2};
+
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+ // Test wrapper declaration : wrapping nothing for the moment
+ struct sechandler_basic_test
+ {
+ std::string mPemTestCert, mPemRootCert, mPemIntermediateCert, mPemChildCert, mSha1RSATestCert, mSha1RSATestCA;
+ std::string mDerFormat;
+ X509 *mX509TestCert, *mX509RootCert, *mX509IntermediateCert, *mX509ChildCert;
+
+ sechandler_basic_test()
+ {
+ OpenSSL_add_all_algorithms();
+ OpenSSL_add_all_ciphers();
+ OpenSSL_add_all_digests();
+ ERR_load_crypto_strings();
+ gFirstName = "";
+ gLastName = "";
+ LLFile::remove("test_password.dat");
+ LLFile::remove("sechandler_settings.tmp");
+ mPemTestCert = "-----BEGIN CERTIFICATE-----\n"
+ "MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIx\n"
+ "EzARBgNVBAoTCklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25h\n"
+ "bCBkZSBUZWNub2xvZ2lhIGRhIEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJy\n"
+ "YXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UEAxMoQXV0b3JpZGFkZSBDZXJ0aWZp\n"
+ "Y2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4MDBaFw0xMTExMzAy\n"
+ "MzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9MDsG\n"
+ "A1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3Jt\n"
+ "YWNhbyAtIElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYD\n"
+ "VQQDEyhBdXRvcmlkYWRlIENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIB\n"
+ "IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVA\n"
+ "isamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma/3pUpgcfNAj0vYm5gsyj\n"
+ "Qo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt4CyNrY50\n"
+ "QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYt\n"
+ "bRhFboUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbUR\n"
+ "yEeNvZneVRKAAU6ouwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwID\n"
+ "AQABo4HSMIHPME4GA1UdIARHMEUwQwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0\n"
+ "cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQQ2FjcmFpei5wZGYwPQYDVR0f\n"
+ "BDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0xDUmFj\n"
+ "cmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB\n"
+ "/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1\n"
+ "U/hgIh6OcgLAfiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGl\n"
+ "YjJe+9zd+izPRbBqXPVQA34EXcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75Fos\n"
+ "SzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQfS//JYeIc7Fue2JNLd00UOSMMaiK/\n"
+ "t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr1ME7a55lFEnSeT0u\n"
+ "mlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5nmPb\n"
+ "K+9A46sd33oqK8n8\n"
+ "-----END CERTIFICATE-----\n";
+
+ mPemRootCert = "-----BEGIN CERTIFICATE-----\n"
+ "MIIB0TCCATqgAwIBAgIJANaTqrzEvHaRMA0GCSqGSIb3DQEBBAUAMBsxGTAXBgNV\n"
+ "BAMTEFJveGllcyB0ZXN0IHJvb3QwHhcNMDkwNDE1MjEwNzQ3WhcNMTAwNDE1MjEw\n"
+ "NzQ3WjAbMRkwFwYDVQQDExBSb3hpZXMgdGVzdCByb290MIGfMA0GCSqGSIb3DQEB\n"
+ "AQUAA4GNADCBiQKBgQCpo5nDW6RNz9IHUVZd7Tw2XAQiBniDF4xH0N1w7sUYTiFq\n"
+ "21mABsnOPJD3ra+MtOsXPHcaljm661JjTD8L40v5sfEbqDUPcOw76ClrPqnuAeyT\n"
+ "38qk8DHku/mT8YdprevGZdVcUXQg3vosVzOL93HOOHK+u61mEEoM9W5xoNVEdQID\n"
+ "AQABox0wGzAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQQF\n"
+ "AAOBgQAzn0aW/+zWPmcTbvxonyiYYUr9b4SOB/quhAkT8KT4ir1dcZAXRR59+kEn\n"
+ "HSTu1FAodV0gvESqyobftF5hZ1XMxdJqGu//xP+YCwlv244G/0pp7KLI8ihNO2+N\n"
+ "lPBUJgbo++ZkhiE1jotZi9Ay0Oedh3s/AfbMZPyfpJ23ll6+BA==\n"
+ "-----END CERTIFICATE-----\n";
+
+
+
+ mPemIntermediateCert = "-----BEGIN CERTIFICATE-----\n"
+ "MIIBzzCCATigAwIBAgIBATANBgkqhkiG9w0BAQQFADAbMRkwFwYDVQQDExBSb3hp\n"
+ "ZXMgdGVzdCByb290MB4XDTA5MDQxNTIxMzE1NloXDTEwMDQxNTIxMzE1NlowITEf\n"
+ "MB0GA1UEAxMWUm94aWVzIGludGVybWVkaWF0ZSBDQTCBnzANBgkqhkiG9w0BAQEF\n"
+ "AAOBjQAwgYkCgYEA15MM0W1R37rx/24Q2Qkb5bSiQZxTUcQAhJ2pA8mwUucXuCVt\n"
+ "6ayI2TuN32nkjmsCgUkiT/bdXWp0OJo7/MXRIFeUNMCRxrpeFnxuigYEqbIXAdN6\n"
+ "qu/vdG2X4PRv/v9Ijrju4cBEiKIldIgOurWEIfXEsVSFP2XmFQHesF04qDcCAwEA\n"
+ "AaMdMBswDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEEBQAD\n"
+ "gYEAYljikYgak3W1jSo0vYthNHUy3lBVAKzDhpM96lY5OuXFslpCRX42zNL8X3kN\n"
+ "U/4IaJUVtZqx8WsUXl1eXHzBCaXCftapV4Ir6cENLIsXCdXs8paFYzN5nPJA5GYU\n"
+ "zWgkSEl1MEhNIc+bJW34vwi29EjrAShAhsIZ84Mt/lvD3Pc=\n"
+ "-----END CERTIFICATE-----\n";
+
+ mPemChildCert = "-----BEGIN CERTIFICATE-----\n"
+ "MIIB5DCCAU0CBEnm9eUwDQYJKoZIhvcNAQEEBQAwITEfMB0GA1UEAxMWUm94aWVz\n"
+ "IGludGVybWVkaWF0ZSBDQTAeFw0wOTA0MTYwMDAzNDlaFw0xMDA0MTYwMDAzNDla\n"
+ "MCAxHjAcBgNVBAMTFWVuaWFjNjMubGluZGVubGFiLmNvbTCBnzANBgkqhkiG9w0B\n"
+ "AQEFAAOBjQAwgYkCgYEAp9I5rofEzbjNht+9QejfnsIlEPqSxskoWKCG255TesWR\n"
+ "RTmw9wafHQQkJk/VIsaU4RMBYHkknGbHX2dGvMHmKZoWUPSQ/8FZz09o0Qx3TNUZ\n"
+ "l7KlGOD2d1c7ZxXDPqlLC6QW8DrE1/8zfwJ5cbYBXc8e7OKdSZeRrnwHyw4Q8r8C\n"
+ "AwEAAaMvMC0wEwYDVR0lBAwwCgYIKwYBBQUHAwEwCQYDVR0TBAIwADALBgNVHQ8E\n"
+ "BAMCBaAwDQYJKoZIhvcNAQEEBQADgYEAIG0M5tqYlXyMiGKPZfXy/R3M3ZZOapDk\n"
+ "W0dsXJYXAc35ftwtn0VYu9CNnZCcli17/d+AKhkK8a/oGPazqudjFF6WLJLTXaY9\n"
+ "NmhkJcOPADXkbyQPUPXzLe4YRrkEQeGhzMb4rKDQ1TKAcXfs0Y068pTpsixNSxja\n"
+ "NhAUUcve5Is=\n"
+ "-----END CERTIFICATE-----\n";
+
+ mDerFormat = "MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIxEzARBgNVBAoT"
+"CklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25hbCBkZSBUZWNub2xvZ2lhIGRh"
+"IEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJyYXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UE"
+"AxMoQXV0b3JpZGFkZSBDZXJ0aWZpY2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4"
+"MDBaFw0xMTExMzAyMzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9"
+"MDsGA1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3JtYWNhbyAt"
+"IElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYDVQQDEyhBdXRvcmlkYWRl"
+"IENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB"
+"CgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVAisamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma"
+"/3pUpgcfNAj0vYm5gsyjQo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt"
+"4CyNrY50QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYtbRhF"
+"boUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbURyEeNvZneVRKAAU6o"
+"uwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwIDAQABo4HSMIHPME4GA1UdIARHMEUw"
+"QwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQ"
+"Q2FjcmFpei5wZGYwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292"
+"LmJyL0xDUmFjcmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB"
+"/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1U/hgIh6OcgLA"
+"fiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGlYjJe+9zd+izPRbBqXPVQA34E"
+"Xcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75FosSzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQf"
+"S//JYeIc7Fue2JNLd00UOSMMaiK/t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr"
+"1ME7a55lFEnSeT0umlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5"
+"nmPbK+9A46sd33oqK8n8";
+
+ mSha1RSATestCert = "-----BEGIN CERTIFICATE-----\n"
+ "MIIDFDCCAn2gAwIBAgIDDqqYMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT\n"
+ "MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0\n"
+ "aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTAwMTA1MDAzNjMwWhcNMTEwMTA3MjAyMTE0\n"
+ "WjCBnjEpMCcGA1UEBRMgQmNmc0RBRkl1U0YwdFpWVm5vOFJKbjVUbW9hNGR2Wkgx\n"
+ "CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4g\n"
+ "RnJhbmNpc2NvMR0wGwYDVQQKExRMaW5kZW4gUmVzZWFyY2ggSW5jLjEYMBYGA1UE\n"
+ "AxQPKi5saW5kZW5sYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2\n"
+ "14Jdko8v6GB33hHbW+lNQyloFQtc2h4ykjf+fYPJ27dw6tQO2if7N3k/5XDkwC1N\n"
+ "krGgE9vt3iecCPgasue6k67Zyfj9HbEP2D+j38eROudrsxLaRFDQx50BvZ5YMNl3\n"
+ "4zQCj8/gCMsuq8cvaP9/rbJTUpgYWFGLsm8yAYOgWwIDAQABo4GuMIGrMA4GA1Ud\n"
+ "DwEB/wQEAwIE8DAdBgNVHQ4EFgQUIBK/JB9AyqquSEbkzt2Zux6v9sYwOgYDVR0f\n"
+ "BDMwMTAvoC2gK4YpaHR0cDovL2NybC5nZW90cnVzdC5jb20vY3Jscy9zZWN1cmVj\n"
+ "YS5jcmwwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gjIBBPM5iQn9QwHQYDVR0lBBYw\n"
+ "FAYIKwYBBQUHAwEGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUAA4GBAKKR84+hvLuB\n"
+ "pop9VG7HQPIyEKtZq3Nnk+UlJGfjGY3csLWSFmxU727r5DzdEP1W1PwF3rxuoKcZ\n"
+ "4nJJpKdzoGVujgBMP2U/J0PJvU7D8U3Zqu7nrXAjOHj7iVnvJ3EKJ1bvwXaisgPN\n"
+ "wt21kKfGnA4OlhJtJ6VQvUkcF12I3pTP\n"
+ "-----END CERTIFICATE-----\n";
+
+ mSha1RSATestCA = "-----BEGIN CERTIFICATE-----\n"
+ "MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV\n"
+ "UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy\n"
+ "dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1\n"
+ "MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx\n"
+ "dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B\n"
+ "AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f\n"
+ "BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A\n"
+ "cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC\n"
+ "AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ\n"
+ "MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm\n"
+ "aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw\n"
+ "ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj\n"
+ "IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF\n"
+ "MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA\n"
+ "A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y\n"
+ "7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh\n"
+ "1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4\n"
+ "-----END CERTIFICATE-----\n";
+
+
+
+
+ mX509TestCert = NULL;
+ mX509RootCert = NULL;
+ mX509IntermediateCert = NULL;
+ mX509ChildCert = NULL;
+
+ BIO * validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL);
+ BIO_free(validation_bio);
+ validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL);
+ BIO_free(validation_bio);
+ validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL);
+ BIO_free(validation_bio);
+ validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL);
+ BIO_free(validation_bio);
+ }
+ ~sechandler_basic_test()
+ {
+ LLFile::remove("test_password.dat");
+ LLFile::remove("sechandler_settings.tmp");
+ LLFile::remove("mycertstore.pem");
+ X509_free(mX509TestCert);
+ X509_free(mX509RootCert);
+ X509_free(mX509IntermediateCert);
+ X509_free(mX509ChildCert);
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<sechandler_basic_test> sechandler_basic_test_factory;
+ typedef sechandler_basic_test_factory::object sechandler_basic_test_object;
+ tut::sechandler_basic_test_factory tut_test("llsechandler_basic");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // test cert data retrieval
+ template<> template<>
+ void sechandler_basic_test_object::test<1>()
+
+ {
+ char buffer[4096];
+ LLPointer<LLCertificate> test_cert = new LLBasicCertificate(mPemTestCert);
+
+ ensure_equals("Resultant pem is correct",
+ mPemTestCert, test_cert->getPem());
+ std::vector<U8> binary_cert = test_cert->getBinary();
+
+ apr_base64_encode(buffer, (const char *)&binary_cert[0], binary_cert.size());
+
+ ensure_equals("Der Format is correct", memcmp(buffer, mDerFormat.c_str(), mDerFormat.length()), 0);
+
+ LLSD llsd_cert = test_cert->getLLSD();
+ std::ostringstream llsd_value;
+ llsd_value << LLSDOStreamer<LLSDNotationFormatter>(llsd_cert) << std::endl;
+ std::string llsd_cert_str = llsd_value.str();
+ ensure_equals("Issuer Name/commonName",
+ (std::string)llsd_cert["issuer_name"]["commonName"], "Autoridade Certificadora Raiz Brasileira");
+ ensure_equals("Issure Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "BR");
+ ensure_equals("Issuer Name/localityName", (std::string)llsd_cert["issuer_name"]["localityName"], "Brasilia");
+ ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "ICP-Brasil");
+ ensure_equals("IssuerName/org unit",
+ (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Instituto Nacional de Tecnologia da Informacao - ITI");
+ ensure_equals("IssuerName/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "DF");
+ ensure_equals("Issuer name string",
+ (std::string)llsd_cert["issuer_name_string"], "CN=Autoridade Certificadora Raiz Brasileira,ST=DF,"
+ "L=Brasilia,OU=Instituto Nacional de Tecnologia da Informacao - ITI,O=ICP-Brasil,C=BR");
+ ensure_equals("subject Name/commonName",
+ (std::string)llsd_cert["subject_name"]["commonName"], "Autoridade Certificadora Raiz Brasileira");
+ ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "BR");
+ ensure_equals("subject Name/localityName", (std::string)llsd_cert["subject_name"]["localityName"], "Brasilia");
+ ensure_equals("subject Name/org name", (std::string)llsd_cert["subject_name"]["organizationName"], "ICP-Brasil");
+ ensure_equals("subjectName/org unit",
+ (std::string)llsd_cert["subject_name"]["organizationalUnitName"], "Instituto Nacional de Tecnologia da Informacao - ITI");
+ ensure_equals("subjectName/state", (std::string)llsd_cert["subject_name"]["stateOrProvinceName"], "DF");
+ ensure_equals("subject name string",
+ (std::string)llsd_cert["subject_name_string"], "CN=Autoridade Certificadora Raiz Brasileira,ST=DF,"
+ "L=Brasilia,OU=Instituto Nacional de Tecnologia da Informacao - ITI,O=ICP-Brasil,C=BR");
+
+ ensure_equals("md5 digest", (std::string)llsd_cert["md5_digest"], "96:89:7d:61:d1:55:2b:27:e2:5a:39:b4:2a:6c:44:6f");
+ ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "04");
+ // sha1 digest is giving a weird value, and I've no idea why...feh
+ //ensure_equals("sha1 digest", (std::string)llsd_cert["sha1_digest"], "8e:fd:ca:bc:93:e6:1e:92:5d:4d:1d:ed:18:1a:43:20:a4:67:a1:39");
+ ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2001-11-30T12:58:00Z");
+ ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2011-11-30T23:59:00Z");
+ LLSD expectedKeyUsage = LLSD::emptyArray();
+ expectedKeyUsage.append(LLSD((std::string)"certSigning"));
+ expectedKeyUsage.append(LLSD((std::string)"crlSigning"));
+ ensure("key usage", valueCompareLLSD(llsd_cert["keyUsage"], expectedKeyUsage));
+ ensure("basic constraints", (bool)llsd_cert["basicConstraints"]["CA"]);
+
+ ensure("x509 is equal", !X509_cmp(mX509TestCert, test_cert->getOpenSSLX509()));
+ }
+
+
+ // test protected data
+ template<> template<>
+ void sechandler_basic_test_object::test<2>()
+
+ {
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
+
+ std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u"
+ "GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO"
+ "nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq"
+ "4ZT9Y4wZ9Rh8nnF3fDUL6IGamHe1ClXM1jgBu10F6UMhZbnH4C3aJ2E9+LiOntU+l3iCb2MpkEpr"
+ "82r2ZAMwIrpnirL/xoYoyz7MJQYwUuMvBPToZJrxNSsjI+S2Z+I3iEJAELMAAA==";
+
+ std::vector<U8> binary_data(apr_base64_decode_len(protected_data.c_str()));
+ apr_base64_decode_binary(&binary_data[0], protected_data.c_str());
+
+ LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
+ cipher.decrypt(&binary_data[0], 16);
+ LLXORCipher cipher2(MACAddress, MAC_ADDRESS_BYTES);
+ cipher2.encrypt(&binary_data[0], 16);
+ std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary);
+ temp_file.write((const char *)&binary_data[0], binary_data.size());
+ temp_file.close();
+
+ LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
+ "test_password.dat");
+ handler->init();
+ // data retrieval for existing data
+ LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
+
+
+ ensure_equals("retrieve existing data1", (std::string)data["data1"], "test_data_1");
+ ensure_equals("retrieve existing data2", (std::string)data["data2"], "test_data_2");
+ ensure_equals("retrieve existing data3", (std::string)data["data3"]["elem1"], "test element1");
+
+ // data storage
+ LLSD store_data = LLSD::emptyMap();
+ store_data["store_data1"] = "test_store_data1";
+ store_data["store_data2"] = 27;
+ store_data["store_data3"] = LLSD::emptyMap();
+ store_data["store_data3"]["subelem1"] = "test_subelem1";
+
+ handler->setProtectedData("test_data_type", "test_data_id1", store_data);
+ data = handler->getProtectedData("test_data_type", "test_data_id");
+
+ data = handler->getProtectedData("test_data_type", "test_data_id");
+ // verify no overwrite of existing data
+ ensure_equals("verify no overwrite 1", (std::string)data["data1"], "test_data_1");
+ ensure_equals("verify no overwrite 2", (std::string)data["data2"], "test_data_2");
+ ensure_equals("verify no overwrite 3", (std::string)data["data3"]["elem1"], "test element1");
+
+ // verify written data is good
+ data = handler->getProtectedData("test_data_type", "test_data_id1");
+ ensure_equals("verify stored data1", (std::string)data["store_data1"], "test_store_data1");
+ ensure_equals("verify stored data2", (int)data["store_data2"], 27);
+ ensure_equals("verify stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
+
+ // verify overwrite works
+ handler->setProtectedData("test_data_type", "test_data_id", store_data);
+ data = handler->getProtectedData("test_data_type", "test_data_id");
+ ensure_equals("verify overwrite stored data1", (std::string)data["store_data1"], "test_store_data1");
+ ensure_equals("verify overwrite stored data2", (int)data["store_data2"], 27);
+ ensure_equals("verify overwrite stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
+
+ // verify other datatype doesn't conflict
+ store_data["store_data3"] = "test_store_data3";
+ store_data["store_data4"] = 28;
+ store_data["store_data5"] = LLSD::emptyMap();
+ store_data["store_data5"]["subelem2"] = "test_subelem2";
+
+ handler->setProtectedData("test_data_type1", "test_data_id", store_data);
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure_equals("verify datatype stored data3", (std::string)data["store_data3"], "test_store_data3");
+ ensure_equals("verify datatype stored data4", (int)data["store_data4"], 28);
+ ensure_equals("verify datatype stored data5", (std::string)data["store_data5"]["subelem2"], "test_subelem2");
+
+ // test data not found
+
+ data = handler->getProtectedData("test_data_type1", "test_data_not_found");
+ ensure("not found", data.isUndefined());
+
+ // cause a 'write' by using 'LLPointer' to delete then instantiate a handler
+ handler = NULL;
+ handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
+ ensure_equals("verify datatype stored data4a", (int)data["store_data4"], 28);
+ ensure_equals("verify datatype stored data5a", (std::string)data["store_data5"]["subelem2"], "test_subelem2");
+
+ // rewrite the initial file to verify reloads
+ handler = NULL;
+ std::ofstream temp_file2("sechandler_settings.tmp", std::ofstream::binary);
+ temp_file2.write((const char *)&binary_data[0], binary_data.size());
+ temp_file2.close();
+
+ // cause a 'write'
+ handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure("not found", data.isUndefined());
+
+ handler->deleteProtectedData("test_data_type", "test_data_id");
+ ensure("Deleted data not found", handler->getProtectedData("test_data_type", "test_data_id").isUndefined());
+
+ LLFile::remove("sechandler_settings.tmp");
+ handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure("not found", data.isUndefined());
+ handler = NULL;
+
+ ensure(LLFile::isfile("sechandler_settings.tmp"));
+ }
+
+ // test credenitals
+ template<> template<>
+ void sechandler_basic_test_object::test<3>()
+ {
+ LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+
+ LLSD my_id = LLSD::emptyMap();
+ LLSD my_authenticator = LLSD::emptyMap();
+ my_id["type"] = "test_type";
+ my_id["username"] = "testuser@lindenlab.com";
+ my_authenticator["type"] = "test_auth";
+ my_authenticator["creds"] = "12345";
+
+ // test creation of credentials
+ LLPointer<LLCredential> my_cred = handler->createCredential("my_grid", my_id, my_authenticator);
+
+ // test retrieval of credential components
+ ensure_equals("basic credential creation: identifier", my_id, my_cred->getIdentifier());
+ ensure_equals("basic credential creation: authenticator", my_authenticator, my_cred->getAuthenticator());
+ ensure_equals("basic credential creation: grid", "my_grid", my_cred->getGrid());
+
+ // test setting/overwriting of credential components
+ my_id["first_name"] = "firstname";
+ my_id.erase("username");
+ my_authenticator.erase("creds");
+ my_authenticator["hash"] = "6563245";
+
+ my_cred->setCredentialData(my_id, my_authenticator);
+ ensure_equals("set credential data: identifier", my_id, my_cred->getIdentifier());
+ ensure_equals("set credential data: authenticator", my_authenticator, my_cred->getAuthenticator());
+ ensure_equals("set credential data: grid", "my_grid", my_cred->getGrid());
+
+ // test loading of a credential, that hasn't been saved, without
+ // any legacy saved credential data
+ LLPointer<LLCredential> my_new_cred = handler->loadCredential("my_grid2");
+ ensure("unknown credential load test", my_new_cred->getIdentifier().isMap());
+ ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type"));
+ ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap());
+ ensure("unknown credential load test", !my_new_cred->getAuthenticator().has("type"));
+ // test saving of a credential
+ handler->saveCredential(my_cred, true);
+
+ // test loading of a known credential
+ my_new_cred = handler->loadCredential("my_grid");
+ ensure_equals("load a known credential: identifier", my_id, my_new_cred->getIdentifier());
+ ensure_equals("load a known credential: authenticator",my_authenticator, my_new_cred->getAuthenticator());
+ ensure_equals("load a known credential: grid", "my_grid", my_cred->getGrid());
+
+ // test deletion of a credential
+ handler->deleteCredential(my_new_cred);
+
+ ensure("delete credential: identifier", my_new_cred->getIdentifier().isUndefined());
+ ensure("delete credentialt: authenticator", my_new_cred->getIdentifier().isUndefined());
+ ensure_equals("delete credential: grid", "my_grid", my_cred->getGrid());
+ // load unknown cred
+
+ my_new_cred = handler->loadCredential("my_grid");
+ ensure("deleted credential load test", my_new_cred->getIdentifier().isMap());
+ ensure("deleted credential load test", !my_new_cred->getIdentifier().has("type"));
+ ensure("deleted credential load test", my_new_cred->getAuthenticator().isMap());
+ ensure("deleted credential load test", !my_new_cred->getAuthenticator().has("type"));
+
+ // test loading of an unknown credential with legacy saved username, but without
+ // saved password
+ gFirstName = "myfirstname";
+ gLastName = "mylastname";
+ my_new_cred = handler->loadCredential("my_legacy_grid");
+ ensure_equals("legacy credential with no password: type",
+ (const std::string)my_new_cred->getIdentifier()["type"], "agent");
+ ensure_equals("legacy credential with no password: first_name",
+ (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
+ ensure_equals("legacy credential with no password: last_name",
+ (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
+
+ ensure("legacy credential with no password: no authenticator", my_new_cred->getAuthenticator().isUndefined());
+
+ // test loading of an unknown credential with legacy saved password and username
+
+ std::string hashed_password = "fSQcLG03eyIWJmkzfyYaKm81dSweLmsxeSAYKGE7fSQ=";
+ int length = apr_base64_decode_len(hashed_password.c_str());
+ std::vector<char> decoded_password(length);
+ apr_base64_decode(&decoded_password[0], hashed_password.c_str());
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
+ LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
+ cipher.decrypt((U8*)&decoded_password[0], length);
+ LLXORCipher cipher2(MACAddress, MAC_ADDRESS_BYTES);
+ cipher2.encrypt((U8*)&decoded_password[0], length);
+ llofstream password_file("test_password.dat", std::ofstream::binary);
+ password_file.write(&decoded_password[0], length);
+ password_file.close();
+
+ my_new_cred = handler->loadCredential("my_legacy_grid2");
+ ensure_equals("legacy credential with password: type",
+ (const std::string)my_new_cred->getIdentifier()["type"], "agent");
+ ensure_equals("legacy credential with password: first_name",
+ (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
+ ensure_equals("legacy credential with password: last_name",
+ (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
+
+ LLSD legacy_authenticator = my_new_cred->getAuthenticator();
+ ensure_equals("legacy credential with password: type",
+ (std::string)legacy_authenticator["type"],
+ "hash");
+ ensure_equals("legacy credential with password: algorithm",
+ (std::string)legacy_authenticator["algorithm"],
+ "md5");
+ ensure_equals("legacy credential with password: algorithm",
+ (std::string)legacy_authenticator["secret"],
+ "01234567890123456789012345678901");
+
+ // test creation of credentials
+ my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator);
+ // test save without saving authenticator.
+ handler->saveCredential(my_cred, FALSE);
+ my_new_cred = handler->loadCredential("mysavedgrid");
+ ensure_equals("saved credential without auth",
+ (const std::string)my_new_cred->getIdentifier()["type"], "test_type");
+ ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined());
+ }
+
+ // test cert vector
+ template<> template<>
+ void sechandler_basic_test_object::test<4>()
+ {
+
+ // validate create from empty vector
+ LLPointer<LLBasicCertificateVector> test_vector = new LLBasicCertificateVector();
+ ensure_equals("when loading with nothing, we should result in no certs in vector", test_vector->size(), 0);
+
+ test_vector->add(new LLBasicCertificate(mPemTestCert));
+ ensure_equals("one element in vector", test_vector->size(), 1);
+ test_vector->add(new LLBasicCertificate(mPemChildCert));
+ ensure_equals("two elements in vector after add", test_vector->size(), 2);
+
+ test_vector->add(new LLBasicCertificate(mPemChildCert));
+ ensure_equals("two elements in vector after re-add", test_vector->size(), 2);
+ // validate order
+ X509* test_cert = (*test_vector)[0]->getOpenSSLX509();
+ ensure("first cert added remains first cert", !X509_cmp(test_cert, mX509TestCert));
+ X509_free(test_cert);
+
+ test_cert = (*test_vector)[1]->getOpenSSLX509();
+ ensure("adding a duplicate cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ //
+ // validate iterator
+ //
+ LLBasicCertificateVector::iterator current_cert = test_vector->begin();
+ LLBasicCertificateVector::iterator copy_current_cert = current_cert;
+ // operator++(int)
+ ensure("validate iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[0]);
+ ensure("validate 2nd iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[1]);
+ ensure("validate end iterator++", current_cert == test_vector->end());
+
+ // copy
+ ensure("validate copy iterator element in vector is expected cert", *copy_current_cert == (*test_vector)[0]);
+
+ // operator--(int)
+ current_cert--;
+ ensure("validate iterator-- element in vector is expected cert", *current_cert-- == (*test_vector)[1]);
+ ensure("validate iterator-- element in vector is expected cert", *current_cert == (*test_vector)[0]);
+
+ ensure("begin iterator is equal", current_cert == test_vector->begin());
+
+ // operator++
+ ensure("validate ++iterator element in vector is expected cert", *++current_cert == (*test_vector)[1]);
+ ensure("end of cert vector after ++iterator", ++current_cert == test_vector->end());
+ // operator--
+ ensure("validate --iterator element in vector is expected cert", *--current_cert == (*test_vector)[1]);
+ ensure("validate 2nd --iterator element in vector is expected cert", *--current_cert == (*test_vector)[0]);
+
+ // validate remove
+ // validate create from empty vector
+ test_vector = new LLBasicCertificateVector();
+ test_vector->add(new LLBasicCertificate(mPemTestCert));
+ test_vector->add(new LLBasicCertificate(mPemChildCert));
+ test_vector->erase(test_vector->begin());
+ ensure_equals("one element in store after remove", test_vector->size(), 1);
+ test_cert = (*test_vector)[0]->getOpenSSLX509();
+ ensure("validate cert was removed", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ // validate insert
+ test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemChildCert));
+ test_cert = (*test_vector)[0]->getOpenSSLX509();
+
+ ensure("validate cert was inserted", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ //validate find
+ LLSD find_info = LLSD::emptyMap();
+ test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemRootCert));
+ find_info["issuer_name"] = LLSD::emptyMap();
+ find_info["issuer_name"]["commonName"] = "Roxies intermediate CA";
+ find_info["md5_digest"] = "97:24:c7:4c:d4:ba:2d:0e:9c:a1:18:8e:3a:c6:1f:c3";
+ current_cert = test_vector->find(find_info);
+ ensure("found", current_cert != test_vector->end());
+ ensure("found cert", (*current_cert).get() == (*test_vector)[1].get());
+ find_info["sha1_digest"] = "bad value";
+ current_cert =test_vector->find(find_info);
+ ensure("didn't find cert", current_cert == test_vector->end());
+ }
+
+ // test cert store
+ template<> template<>
+ void sechandler_basic_test_object::test<5>()
+ {
+ // validate load with nothing
+ LLFile::remove("mycertstore.pem");
+ LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
+
+ // validate load with empty file
+ test_store->save();
+ test_store = NULL;
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
+ test_store=NULL;
+
+ // instantiate a cert store from a file
+ llofstream certstorefile("mycertstore.pem", std::ios::out);
+ certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl;
+ certstorefile.close();
+ // validate loaded certs
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("two elements in store", test_store->size(), 2);
+
+ // operator[]
+ X509* test_cert = (*test_store)[0]->getOpenSSLX509();
+
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_store)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
+ X509_free(test_cert);
+
+
+ // validate save
+ LLFile::remove("mycertstore.pem");
+ test_store->save();
+ test_store = NULL;
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("two elements in store after save", test_store->size(), 2);
+ LLCertificateStore::iterator current_cert = test_store->begin();
+ test_cert = (*current_cert)->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ current_cert++;
+ X509_free(test_cert);
+ test_cert = (*current_cert)->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
+ X509_free(test_cert);
+ current_cert++;
+ ensure("end of cert store", current_cert == test_store->end());
+
+ }
+
+ // cert name wildcard matching
+ template<> template<>
+ void sechandler_basic_test_object::test<6>()
+ {
+ ensure("simple name match",
+ _cert_hostname_wildcard_match("foo", "foo"));
+
+ ensure("simple name match, with end period",
+ _cert_hostname_wildcard_match("foo.", "foo."));
+
+ ensure("simple name match, with begin period",
+ _cert_hostname_wildcard_match(".foo", ".foo"));
+
+ ensure("simple name match, with mismatched period cn",
+ _cert_hostname_wildcard_match("foo.", "foo"));
+
+ ensure("simple name match, with mismatched period hostname",
+ _cert_hostname_wildcard_match("foo", "foo."));
+
+ ensure("simple name match, with subdomain",
+ _cert_hostname_wildcard_match("foo.bar", "foo.bar"));
+
+ ensure("stutter name match",
+ _cert_hostname_wildcard_match("foobbbbfoo", "foo*bbbfoo"));
+
+ ensure("simple name match, with beginning wildcard",
+ _cert_hostname_wildcard_match("foobar", "*bar"));
+
+ ensure("simple name match, with ending wildcard",
+ _cert_hostname_wildcard_match("foobar", "foo*"));
+
+ ensure("simple name match, with beginning null wildcard",
+ _cert_hostname_wildcard_match("foobar", "*foobar"));
+
+ ensure("simple name match, with ending null wildcard",
+ _cert_hostname_wildcard_match("foobar", "foobar*"));
+
+ ensure("simple name match, with embedded wildcard",
+ _cert_hostname_wildcard_match("foobar", "f*r"));
+
+ ensure("simple name match, with embedded null wildcard",
+ _cert_hostname_wildcard_match("foobar", "foo*bar"));
+
+ ensure("simple name match, with dual embedded wildcard",
+ _cert_hostname_wildcard_match("foobar", "f*o*ar"));
+
+ ensure("simple name mismatch",
+ !_cert_hostname_wildcard_match("bar", "foo"));
+
+ ensure("simple name mismatch, with end period",
+ !_cert_hostname_wildcard_match("foobar.", "foo."));
+
+ ensure("simple name mismatch, with begin period",
+ !_cert_hostname_wildcard_match(".foobar", ".foo"));
+
+ ensure("simple name mismatch, with subdomain",
+ !_cert_hostname_wildcard_match("foobar.bar", "foo.bar"));
+
+ ensure("simple name mismatch, with beginning wildcard",
+ !_cert_hostname_wildcard_match("foobara", "*bar"));
+
+ ensure("simple name mismatch, with ending wildcard",
+ !_cert_hostname_wildcard_match("oobar", "foo*"));
+
+ ensure("simple name mismatch, with embedded wildcard",
+ !_cert_hostname_wildcard_match("oobar", "f*r"));
+
+ ensure("simple name mismatch, with dual embedded wildcard",
+ !_cert_hostname_wildcard_match("foobar", "f*d*ar"));
+
+ ensure("simple wildcard",
+ _cert_hostname_wildcard_match("foobar", "*"));
+
+ ensure("long domain",
+ _cert_hostname_wildcard_match("foo.bar.com", "foo.bar.com"));
+
+ ensure("long domain with multiple wildcards",
+ _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com"));
+
+ ensure("end periods",
+ _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com."));
+
+ ensure("match end period",
+ _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com"));
+
+ ensure("match end period2",
+ _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com."));
+
+ ensure("wildcard mismatch",
+ !_cert_hostname_wildcard_match("bar.com", "*.bar.com"));
+
+ ensure("wildcard match",
+ _cert_hostname_wildcard_match("foo.bar.com", "*.bar.com"));
+
+ ensure("wildcard match",
+ _cert_hostname_wildcard_match("foo.foo.bar.com", "*.bar.com"));
+
+ ensure("wildcard match",
+ _cert_hostname_wildcard_match("foo.foo.bar.com", "*.*.com"));
+
+ ensure("wildcard mismatch",
+ !_cert_hostname_wildcard_match("foo.foo.bar.com", "*.foo.com"));
+ }
+
+ // test cert chain
+ template<> template<>
+ void sechandler_basic_test_object::test<7>()
+ {
+ // validate create from empty chain
+ LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
+ ensure_equals("when loading with nothing, we should result in no certs in chain", test_chain->size(), 0);
+
+ // Single cert in the chain.
+ X509_STORE_CTX *test_store = X509_STORE_CTX_new();
+ test_store->cert = mX509ChildCert;
+ test_store->untrusted = NULL;
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 1);
+ X509* test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ // cert + CA
+
+ test_store = X509_STORE_CTX_new();
+ test_store->cert = mX509ChildCert;
+ test_store->untrusted = sk_X509_new_null();
+ sk_X509_push(test_store->untrusted, mX509IntermediateCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 2);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_chain)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
+ X509_free(test_cert);
+
+ // cert + nonrelated
+
+ test_store = X509_STORE_CTX_new();
+ test_store->cert = mX509ChildCert;
+ test_store->untrusted = sk_X509_new_null();
+ sk_X509_push(test_store->untrusted, mX509TestCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 1);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ // cert + CA + nonrelated
+ test_store = X509_STORE_CTX_new();
+ test_store->cert = mX509ChildCert;
+ test_store->untrusted = sk_X509_new_null();
+ sk_X509_push(test_store->untrusted, mX509IntermediateCert);
+ sk_X509_push(test_store->untrusted, mX509TestCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 2);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_chain)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
+ X509_free(test_cert);
+
+ // cert + intermediate + CA
+ test_store = X509_STORE_CTX_new();
+ test_store->cert = mX509ChildCert;
+ test_store->untrusted = sk_X509_new_null();
+ sk_X509_push(test_store->untrusted, mX509IntermediateCert);
+ sk_X509_push(test_store->untrusted, mX509RootCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("three elements in store", test_chain->size(), 3);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_chain)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
+ X509_free(test_cert);
+
+ test_cert = (*test_chain)[2]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509RootCert));
+ X509_free(test_cert);
+ }
+ // test cert validation
+ template<> template<>
+ void sechandler_basic_test_object::test<8>()
+ {
+ // start with a trusted store with our known root cert
+ LLFile::remove("mycertstore.pem");
+ LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
+ test_store->add(new LLBasicCertificate(mX509RootCert));
+ LLSD validation_params;
+
+ // validate basic trust for a chain containing only the intermediate cert. (1 deep)
+ LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
+
+ test_chain->add(new LLBasicCertificate(mX509IntermediateCert));
+
+ test_chain->validate(0, test_store, validation_params);
+
+ // add the root certificate to the chain and revalidate
+ test_chain->add(new LLBasicCertificate(mX509RootCert));
+ test_chain->validate(0, test_store, validation_params);
+
+ // add the child cert at the head of the chain, and revalidate (3 deep chain)
+ test_chain->insert(test_chain->begin(), new LLBasicCertificate(mX509ChildCert));
+ test_chain->validate(0, test_store, validation_params);
+
+ // basic failure cases
+ test_chain = new LLBasicCertificateChain(NULL);
+ //validate with only the child cert
+ test_chain->add(new LLBasicCertificate(mX509ChildCert));
+ ensure_throws("no CA, with only a child cert",
+ LLCertValidationTrustException,
+ (*test_chain)[0],
+ test_chain->validate,
+ VALIDATION_POLICY_TRUSTED,
+ test_store,
+ validation_params);
+
+
+ // validate without the trust flag.
+ test_chain->validate(0, test_store, validation_params);
+
+ // clear out the store
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ // append the intermediate cert
+ test_chain->add(new LLBasicCertificate(mX509IntermediateCert));
+ ensure_throws("no CA, with child and intermediate certs",
+ LLCertValidationTrustException,
+ (*test_chain)[1],
+ test_chain->validate,
+ VALIDATION_POLICY_TRUSTED,
+ test_store,
+ validation_params);
+ // validate without the trust flag
+ test_chain->validate(0, test_store, validation_params);
+
+ // Test time validity
+ LLSD child_info = (*test_chain)[0]->getLLSD();
+ validation_params = LLSD::emptyMap();
+ validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() + 1.0);
+ test_chain->validate(VALIDATION_POLICY_TIME, test_store, validation_params);
+
+ validation_params = LLSD::emptyMap();
+ validation_params[CERT_VALIDATION_DATE] = child_info[CERT_VALID_FROM].asDate();
+
+ validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() - 1.0);
+
+ // test not yet valid
+ ensure_throws("Child cert not yet valid" ,
+ LLCertValidationExpirationException,
+ (*test_chain)[0],
+ test_chain->validate,
+ VALIDATION_POLICY_TIME,
+ test_store,
+ validation_params);
+ validation_params = LLSD::emptyMap();
+ validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_TO].asDate().secondsSinceEpoch() + 1.0);
+
+ // test cert expired
+ ensure_throws("Child cert expired",
+ LLCertValidationExpirationException,
+ (*test_chain)[0],
+ test_chain->validate,
+ VALIDATION_POLICY_TIME,
+ test_store,
+ validation_params);
+
+ // test SSL KU
+ // validate basic trust for a chain containing child and intermediate.
+ test_chain = new LLBasicCertificateChain(NULL);
+ test_chain->add(new LLBasicCertificate(mX509ChildCert));
+ test_chain->add(new LLBasicCertificate(mX509IntermediateCert));
+ test_chain->validate(VALIDATION_POLICY_SSL_KU, test_store, validation_params);
+
+ test_chain = new LLBasicCertificateChain(NULL);
+ test_chain->add(new LLBasicCertificate(mX509TestCert));
+
+ ensure_throws("Cert doesn't have ku",
+ LLCertKeyUsageValidationException,
+ (*test_chain)[0],
+ test_chain->validate,
+ VALIDATION_POLICY_SSL_KU,
+ test_store,
+ validation_params);
+
+ // test sha1RSA validation
+ test_chain = new LLBasicCertificateChain(NULL);
+ test_chain->add(new LLBasicCertificate(mSha1RSATestCert));
+ test_chain->add(new LLBasicCertificate(mSha1RSATestCA));
+
+ test_chain->validate(0, test_store, validation_params);
+ }
+
+};
+
diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp
new file mode 100644
index 0000000000..803020dc7a
--- /dev/null
+++ b/indra/newview/tests/llslurl_test.cpp
@@ -0,0 +1,258 @@
+/**
+ * @file llsecapi_test.cpp
+ * @author Roxie
+ * @date 2009-02-10
+ * @brief Test the sec api functionality
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version maps.secondlife.com2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../llviewernetwork.h"
+#include "../test/lltut.h"
+#include "../llslurl.h"
+#include "../../llxml/llcontrol.h"
+#include "llsdserialize.h"
+//----------------------------------------------------------------------------
+// Mock objects for the dependencies of the code we're testing
+
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+ const std::string& initial_val,
+ const std::string& comment,
+ BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+
+std::string gCmdLineLoginURI;
+std::string gCmdLineGridChoice;
+std::string gCmdLineHelperURI;
+std::string gLoginPage;
+std::string gCurrentGrid;
+std::string LLControlGroup::getString(const std::string& name)
+{
+ if (name == "CmdLineGridChoice")
+ return gCmdLineGridChoice;
+ else if (name == "CmdLineHelperURI")
+ return gCmdLineHelperURI;
+ else if (name == "LoginPage")
+ return gLoginPage;
+ else if (name == "CurrentGrid")
+ return gCurrentGrid;
+ return "";
+}
+
+LLSD LLControlGroup::getLLSD(const std::string& name)
+{
+ if (name == "CmdLineLoginURI")
+ {
+ if(!gCmdLineLoginURI.empty())
+ {
+ return LLSD(gCmdLineLoginURI);
+ }
+ }
+ return LLSD();
+}
+
+
+LLControlGroup gSavedSettings("test");
+
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+ // Test wrapper declaration : wrapping nothing for the moment
+ struct slurlTest
+ {
+ slurlTest()
+ {
+ LLGridManager::getInstance()->initialize(std::string(""));
+ }
+ ~slurlTest()
+ {
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<slurlTest> slurlTestFactory;
+ typedef slurlTestFactory::object slurlTestObject;
+ tut::slurlTestFactory tut_test("llslurl");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // construction from slurl string
+ template<> template<>
+ void slurlTestObject::test<1>()
+ {
+ LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+
+ LLSLURL slurl = LLSLURL("");
+ ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION);
+
+ slurl = LLSLURL("http://slurl.com/secondlife/myregion");
+ ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/128/128/0");
+
+ slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3");
+ ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/1/2/3");
+
+ slurl = LLSLURL("secondlife://myregion");
+ ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/128/128/0");
+
+ slurl = LLSLURL("secondlife://myregion/1/2/3");
+ ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/1/2/3");
+
+ slurl = LLSLURL("/myregion");
+ ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("/region slurl, region ", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/128/128/0");
+
+ slurl = LLSLURL("/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("/ slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/1/2/3");
+
+ slurl = LLSLURL("my region/1/2/3");
+ ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/my%20region/1/2/3");
+
+ slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
+ ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("grid slurl, region + coords", slurl.getSLURLString(),
+ "https://my.grid.com/region/my%20region/1/2/3");
+
+ slurl = LLSLURL("https://my.grid.com/region/my region");
+ ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("grid slurl, region + coords", slurl.getSLURLString(),
+ "https://my.grid.com/region/my%20region/128/128/0");
+
+ LLGridManager::getInstance()->setGridChoice("foo.bar.com");
+ slurl = LLSLURL("/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("/ slurl, region + coords", slurl.getSLURLString(),
+ "https://foo.bar.com/region/myregion/1/2/3");
+
+ slurl = LLSLURL("myregion/1/2/3");
+ ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" slurl, region + coords", slurl.getSLURLString(),
+ "https://foo.bar.com/region/myregion/1/2/3");
+
+ slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
+ ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION);
+
+ slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST);
+ ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION);
+
+ slurl = LLSLURL("secondlife:///app/foo/bar?12345");
+ ensure_equals("app", slurl.getType(), LLSLURL::APP);
+ ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+ ensure_equals("apppath", slurl.getAppPath().size(), 1);
+ ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+ ensure_equals("appquery", slurl.getAppQuery(), "12345");
+ ensure_equals("grid1", "foo.bar.com", slurl.getGrid());
+
+ slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345");
+ ensure_equals("app", slurl.getType(), LLSLURL::APP);
+ ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+ ensure_equals("apppath", slurl.getAppPath().size(), 1);
+ ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+ ensure_equals("appquery", slurl.getAppQuery(), "12345");
+ ensure_equals("grid2", "util.aditi.lindenlab.com", slurl.getGrid());
+
+ LLGridManager::getInstance()->setGridChoice("foo.bar.com");
+ slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("region" , "myregion", slurl.getRegion());
+ ensure_equals("grid3", "util.agni.lindenlab.com", slurl.getGrid());
+
+ slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("region" , "myregion", slurl.getRegion());
+ ensure_equals("grid4", "util.aditi.lindenlab.com", slurl.getGrid());
+
+ slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345");
+ ensure_equals("app", slurl.getType(), LLSLURL::APP);
+ ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+ ensure_equals("apppath", slurl.getAppPath().size(), 1);
+ ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+ ensure_equals("appquery", slurl.getAppQuery(), "12345");
+
+ }
+
+ // construction from grid/region/vector combos
+ template<> template<>
+ void slurlTestObject::test<2>()
+ {
+ LLSLURL slurl = LLSLURL("mygrid.com", "my region");
+ ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("grid/region", slurl.getSLURLString(),
+ "https://mygrid.com/region/my%20region/128/128/0");
+
+ slurl = LLSLURL("mygrid.com", "my region", LLVector3(1,2,3));
+ ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" grid/region/vector", slurl.getSLURLString(),
+ "https://mygrid.com/region/my%20region/1/2/3");
+
+ LLGridManager::getInstance()->setGridChoice("foo.bar.com.bar");
+ slurl = LLSLURL("my region", LLVector3(1,2,3));
+ ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" grid/region/vector", slurl.getSLURLString(),
+ "https://foo.bar.com.bar/region/my%20region/1/2/3");
+
+ LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+ slurl = LLSLURL("my region", LLVector3(1,2,3));
+ ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" default grid/region/vector", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/my%20region/1/2/3");
+
+ }
+ // Accessors
+ template<> template<>
+ void slurlTestObject::test<3>()
+ {
+ LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
+ ensure_equals("login string", slurl.getLoginString(), "uri:my region&amp;1&amp;2&amp;3");
+ ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3");
+ ensure_equals("grid", slurl.getGrid(), "my.grid.com");
+ ensure_equals("region", slurl.getRegion(), "my region");
+ ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3));
+
+ }
+}
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
new file mode 100644
index 0000000000..025b570be2
--- /dev/null
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -0,0 +1,456 @@
+/**
+ * @file llviewernetwork_test.cpp
+ * @author Roxie
+ * @date 2009-03-9
+ * @brief Test the viewernetwork functionality
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden LregisterSecAPIab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../llviewernetwork.h"
+#include "../test/lltut.h"
+#include "../../llxml/llcontrol.h"
+#include "llfile.h"
+
+//----------------------------------------------------------------------------
+// Mock objects for the dependencies of the code we're testing
+
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+ const std::string& initial_val,
+ const std::string& comment,
+ BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+
+std::string gCmdLineLoginURI;
+std::string gCmdLineGridChoice;
+std::string gCmdLineHelperURI;
+std::string gLoginPage;
+std::string gCurrentGrid;
+std::string LLControlGroup::getString(const std::string& name)
+{
+ if (name == "CmdLineGridChoice")
+ return gCmdLineGridChoice;
+ else if (name == "CmdLineHelperURI")
+ return gCmdLineHelperURI;
+ else if (name == "LoginPage")
+ return gLoginPage;
+ else if (name == "CurrentGrid")
+ return gCurrentGrid;
+ return "";
+}
+
+LLSD LLControlGroup::getLLSD(const std::string& name)
+{
+ if (name == "CmdLineLoginURI")
+ {
+ if(!gCmdLineLoginURI.empty())
+ {
+ return LLSD(gCmdLineLoginURI);
+ }
+ }
+ return LLSD();
+}
+
+
+LLControlGroup gSavedSettings("test");
+
+const char *gSampleGridFile = "<llsd><map>"
+"<key>grid1</key><map>"
+" <key>favorite</key><integer>1</integer>"
+" <key>helper_uri</key><string>https://helper1/helpers/</string>"
+" <key>label</key><string>mylabel</string>"
+" <key>login_page</key><string>loginpage</string>"
+" <key>login_uri</key><array><string>myloginuri</string></array>"
+" <key>name</key><string>grid1</string>"
+" <key>visible</key><integer>1</integer>"
+" <key>credential_type</key><string>agent</string>"
+" <key>grid_login_id</key><string>MyGrid</string>"
+"</map>"
+"<key>util.agni.lindenlab.com</key><map>"
+" <key>favorite</key><integer>1</integer>"
+" <key>helper_uri</key><string>https://helper1/helpers/</string>"
+" <key>label</key><string>mylabel</string>"
+" <key>login_page</key><string>loginpage</string>"
+" <key>login_uri</key><array><string>myloginuri</string></array>"
+" <key>name</key><string>util.agni.lindenlab.com</string>"
+"</map></map></llsd>";
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+ // Test wrapper declaration : wrapping nothing for the moment
+ struct viewerNetworkTest
+ {
+ viewerNetworkTest()
+ {
+ LLFile::remove("grid_test.xml");
+ gCmdLineLoginURI.clear();
+ gCmdLineGridChoice.clear();
+ gCmdLineHelperURI.clear();
+ gLoginPage.clear();
+ gCurrentGrid.clear();
+ }
+ ~viewerNetworkTest()
+ {
+ LLFile::remove("grid_test.xml");
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<viewerNetworkTest> viewerNetworkTestFactory;
+ typedef viewerNetworkTestFactory::object viewerNetworkTestObject;
+ tut::viewerNetworkTestFactory tut_test("llviewernetwork");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // initialization without a grid file
+ template<> template<>
+ void viewerNetworkTestObject::test<1>()
+ {
+
+ LLGridManager *manager = LLGridManager::getInstance();
+ // grid file doesn't exist
+ manager->initialize("grid_test.xml");
+ // validate that some of the defaults are available.
+ std::map<std::string, std::string> known_grids = manager->getKnownGrids();
+ ensure_equals("Known grids is a string-string map of size 18", known_grids.size(), 18);
+ ensure_equals("Agni has the right name and label",
+ known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni"));
+ ensure_equals("None exists", known_grids[""], "None");
+
+ LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
+ ensure("Grid info for agni is a map", grid.isMap());
+ ensure_equals("name is correct for agni",
+ grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
+ ensure_equals("label is correct for agni",
+ grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
+ ensure("Login URI is an array",
+ grid[GRID_LOGIN_URI_VALUE].isArray());
+ ensure_equals("Agni login uri is correct",
+ grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+ ensure_equals("Agni helper uri is correct",
+ grid[GRID_HELPER_URI_VALUE].asString(),
+ std::string("https://secondlife.com/helpers/"));
+ ensure_equals("Agni login page is correct",
+ grid[GRID_LOGIN_PAGE_VALUE].asString(),
+ std::string("http://secondlife.com/app/login/"));
+ ensure("Agni is a favorite",
+ grid.has(GRID_IS_FAVORITE_VALUE));
+ ensure("Agni is a system grid",
+ grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+ ensure("Grid file wasn't greated as it wasn't saved",
+ !LLFile::isfile("grid_test.xml"));
+ }
+
+ // initialization with a grid file
+ template<> template<>
+ void viewerNetworkTestObject::test<2>()
+ {
+ llofstream gridfile("grid_test.xml");
+ gridfile << gSampleGridFile;
+ gridfile.close();
+
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure_equals("adding a grid via a grid file increases known grid size",
+ known_grids.size(), 19);
+ ensure_equals("Agni is still there after we've added a grid via a grid file",
+ known_grids["util.agni.lindenlab.com"], std::string("Agni"));
+
+
+ // assure Agni doesn't get overwritten
+ LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
+
+ ensure_equals("Agni grid label was not modified by grid file",
+ grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
+
+ ensure_equals("Agni name wasn't modified by grid file",
+ grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
+ ensure("Agni grid URI is still an array after grid file",
+ grid[GRID_LOGIN_URI_VALUE].isArray());
+ ensure_equals("Agni login uri still the same after grid file",
+ grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+ ensure_equals("Agni helper uri still the same after grid file",
+ grid[GRID_HELPER_URI_VALUE].asString(),
+ std::string("https://secondlife.com/helpers/"));
+ ensure_equals("Agni login page the same after grid file",
+ grid[GRID_LOGIN_PAGE_VALUE].asString(),
+ std::string("http://secondlife.com/app/login/"));
+ ensure("Agni still a favorite after grid file",
+ grid.has(GRID_IS_FAVORITE_VALUE));
+ ensure("Agni system grid still set after grid file",
+ grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+
+ ensure_equals("Grid file adds to name<->label map",
+ known_grids["grid1"], std::string("mylabel"));
+ grid = LLGridManager::getInstance()->getGridInfo("grid1");
+ ensure_equals("grid file grid name is set",
+ grid[GRID_VALUE].asString(), std::string("grid1"));
+ ensure_equals("grid file label is set",
+ grid[GRID_LABEL_VALUE].asString(), std::string("mylabel"));
+ ensure("grid file login uri is an array",
+ grid[GRID_LOGIN_URI_VALUE].isArray());
+ ensure_equals("grid file login uri is set",
+ grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ std::string("myloginuri"));
+ ensure_equals("grid file helper uri is set",
+ grid[GRID_HELPER_URI_VALUE].asString(),
+ std::string("https://helper1/helpers/"));
+ ensure_equals("grid file login page is set",
+ grid[GRID_LOGIN_PAGE_VALUE].asString(),
+ std::string("loginpage"));
+ ensure("grid file favorite is set",
+ grid.has(GRID_IS_FAVORITE_VALUE));
+ ensure("grid file isn't a system grid",
+ !grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+ ensure("Grid file still exists after loading",
+ LLFile::isfile("grid_test.xml"));
+ }
+
+ // Initialize via command line
+
+ template<> template<>
+ void viewerNetworkTestObject::test<3>()
+ {
+ gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi";
+
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ // with single login uri specified.
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure_equals("adding a command line grid increases known grid size",
+ known_grids.size(), 19);
+ ensure_equals("Command line grid is added to the list of grids",
+ known_grids["my.login.uri"], std::string("my.login.uri"));
+ LLSD grid = LLGridManager::getInstance()->getGridInfo("my.login.uri");
+ ensure_equals("Command line grid name is set",
+ grid[GRID_VALUE].asString(), std::string("my.login.uri"));
+ ensure_equals("Command line grid label is set",
+ grid[GRID_LABEL_VALUE].asString(), std::string("my.login.uri"));
+ ensure("Command line grid login uri is an array",
+ grid[GRID_LOGIN_URI_VALUE].isArray());
+ ensure_equals("Command line grid login uri is set",
+ grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ std::string("https://my.login.uri/cgi-bin/login.cgi"));
+ ensure_equals("Command line grid helper uri is set",
+ grid[GRID_HELPER_URI_VALUE].asString(),
+ std::string("https://my.login.uri/helpers/"));
+ ensure_equals("Command line grid login page is set",
+ grid[GRID_LOGIN_PAGE_VALUE].asString(),
+ std::string("http://my.login.uri/app/login/"));
+ ensure("Command line grid favorite is set",
+ !grid.has(GRID_IS_FAVORITE_VALUE));
+ ensure("Command line grid isn't a system grid",
+ !grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+
+ // now try a command line with a custom grid identifier
+ gCmdLineGridChoice = "mycustomgridchoice";
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure_equals("adding a command line grid with custom name increases known grid size",
+ known_grids.size(), 19);
+ ensure_equals("Custom Command line grid is added to the list of grids",
+ known_grids["mycustomgridchoice"], std::string("mycustomgridchoice"));
+ grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");
+ ensure_equals("Custom Command line grid name is set",
+ grid[GRID_VALUE].asString(), std::string("mycustomgridchoice"));
+ ensure_equals("Custom Command line grid label is set",
+ grid[GRID_LABEL_VALUE].asString(), std::string("mycustomgridchoice"));
+ ensure("Custom Command line grid login uri is an array",
+ grid[GRID_LOGIN_URI_VALUE].isArray());
+ ensure_equals("Custom Command line grid login uri is set",
+ grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ std::string("https://my.login.uri/cgi-bin/login.cgi"));
+
+ // add a helperuri
+ gCmdLineHelperURI = "myhelperuri";
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");
+ ensure_equals("Validate command line helper uri",
+ grid[GRID_HELPER_URI_VALUE].asString(), std::string("myhelperuri"));
+
+ // add a login page
+ gLoginPage = "myloginpage";
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");
+ ensure_equals("Validate command line helper uri",
+ grid[GRID_LOGIN_PAGE_VALUE].asString(), std::string("myloginpage"));
+ }
+
+ // validate grid selection
+ template<> template<>
+ void viewerNetworkTestObject::test<4>()
+ {
+ LLSD loginURI = LLSD::emptyArray();
+ LLSD grid = LLSD::emptyMap();
+ // adding a grid with simply a name will populate the values.
+ grid[GRID_VALUE] = "myaddedgrid";
+
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ LLGridManager::getInstance()->addGrid(grid);
+ LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+ ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni"));
+ ensure_equals("getGrid", LLGridManager::getInstance()->getGrid(),
+ std::string("util.agni.lindenlab.com"));
+ ensure_equals("getHelperURI", LLGridManager::getInstance()->getHelperURI(),
+ std::string("https://secondlife.com/helpers/"));
+ ensure_equals("getLoginPage", LLGridManager::getInstance()->getLoginPage(),
+ std::string("http://secondlife.com/app/login/"));
+ ensure_equals("getLoginPage2", LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
+ std::string("http://secondlife.com/app/login/"));
+ ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid());
+ std::vector<std::string> uris;
+ LLGridManager::getInstance()->getLoginURIs(uris);
+ ensure_equals("getLoginURIs size", uris.size(), 1);
+ ensure_equals("getLoginURIs", uris[0],
+ std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+ LLGridManager::getInstance()->setGridChoice("myaddedgrid");
+ ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("myaddedgrid"));
+ ensure("Is myaddedgrid a production grid", !LLGridManager::getInstance()->isInProductionGrid());
+
+ LLGridManager::getInstance()->setFavorite();
+ grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid");
+ ensure("setting favorite", grid.has(GRID_IS_FAVORITE_VALUE));
+ }
+
+ // name based grid population
+ template<> template<>
+ void viewerNetworkTestObject::test<5>()
+ {
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ LLSD grid = LLSD::emptyMap();
+ // adding a grid with simply a name will populate the values.
+ grid[GRID_VALUE] = "myaddedgrid";
+ LLGridManager::getInstance()->addGrid(grid);
+ grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid");
+
+ ensure_equals("name based grid has name value",
+ grid[GRID_VALUE].asString(),
+ std::string("myaddedgrid"));
+ ensure_equals("name based grid has label value",
+ grid[GRID_LABEL_VALUE].asString(),
+ std::string("myaddedgrid"));
+ ensure_equals("name based grid has name value",
+ grid[GRID_HELPER_URI_VALUE].asString(),
+ std::string("https://myaddedgrid/helpers/"));
+ ensure_equals("name based grid has name value",
+ grid[GRID_LOGIN_PAGE_VALUE].asString(),
+ std::string("http://myaddedgrid/app/login/"));
+ ensure("name based grid has array loginuri",
+ grid[GRID_LOGIN_URI_VALUE].isArray());
+ ensure_equals("name based grid has single login uri value",
+ grid[GRID_LOGIN_URI_VALUE].size(), 1);
+ ensure_equals("Name based grid login uri is correct",
+ grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ std::string("https://myaddedgrid/cgi-bin/login.cgi"));
+ ensure("name based grid is not a favorite yet",
+ !grid.has(GRID_IS_FAVORITE_VALUE));
+ ensure("name based grid does not have system setting",
+ !grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+
+ llofstream gridfile("grid_test.xml");
+ gridfile << gSampleGridFile;
+ gridfile.close();
+ }
+
+ // persistence of the grid list with an empty gridfile.
+ template<> template<>
+ void viewerNetworkTestObject::test<6>()
+ {
+ // try with initial grid list without a grid file,
+ // without setting the grid to a saveable favorite.
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ LLSD grid = LLSD::emptyMap();
+ grid[GRID_VALUE] = std::string("mynewgridname");
+ LLGridManager::getInstance()->addGrid(grid);
+ LLGridManager::getInstance()->saveFavorites();
+ ensure("Grid file exists after saving",
+ LLFile::isfile("grid_test.xml"));
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ // should not be there
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure("New grid wasn't added to persisted list without being marked a favorite",
+ known_grids.find(std::string("mynewgridname")) == known_grids.end());
+
+ // mark a grid a favorite to make sure it's persisted
+ LLGridManager::getInstance()->addGrid(grid);
+ LLGridManager::getInstance()->setGridChoice("mynewgridname");
+ LLGridManager::getInstance()->setFavorite();
+ LLGridManager::getInstance()->saveFavorites();
+ ensure("Grid file exists after saving",
+ LLFile::isfile("grid_test.xml"));
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ // should not be there
+ known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure("New grid wasn't added to persisted list after being marked a favorite",
+ known_grids.find(std::string("mynewgridname")) !=
+ known_grids.end());
+ }
+
+ // persistence of the grid file with existing gridfile
+ template<> template<>
+ void viewerNetworkTestObject::test<7>()
+ {
+
+ llofstream gridfile("grid_test.xml");
+ gridfile << gSampleGridFile;
+ gridfile.close();
+
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ LLSD grid = LLSD::emptyMap();
+ grid[GRID_VALUE] = std::string("mynewgridname");
+ LLGridManager::getInstance()->addGrid(grid);
+ LLGridManager::getInstance()->saveFavorites();
+ // validate we didn't lose existing favorites
+ LLGridManager::getInstance()->initialize("grid_test.xml");
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure("New grid wasn't added to persisted list after being marked a favorite",
+ known_grids.find(std::string("grid1")) !=
+ known_grids.end());
+
+ // add a grid
+ LLGridManager::getInstance()->addGrid(grid);
+ LLGridManager::getInstance()->setGridChoice("mynewgridname");
+ LLGridManager::getInstance()->setFavorite();
+ LLGridManager::getInstance()->saveFavorites();
+ known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure("New grid wasn't added to persisted list after being marked a favorite",
+ known_grids.find(std::string("grid1")) !=
+ known_grids.end());
+ known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure("New grid wasn't added to persisted list after being marked a favorite",
+ known_grids.find(std::string("mynewgridname")) !=
+ known_grids.end());
+ }
+}
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 668e21c253..2a966f4adf 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -349,6 +349,7 @@ class WindowsManifest(ViewerManifest):
self.path("qtwebkitd4.dll")
self.path("qtxmlpatternsd4.dll")
self.path("ssleay32.dll")
+ self.path("winmm.dll")
# For WebKit/Qt plugin runtimes (image format plugins)
if self.prefix(src="imageformats", dst="imageformats"):
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp
index b9f61ca7e1..e1922367bf 100644
--- a/indra/viewer_components/login/lllogin.cpp
+++ b/indra/viewer_components/login/lllogin.cpp
@@ -122,29 +122,35 @@ private:
LLSD mAuthResponse, mValidAuthResponse;
};
-void LLLogin::Impl::connect(const std::string& uri, const LLSD& credentials)
+void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params)
{
+ LL_DEBUGS("LLLogin") << " connect with uri '" << uri << "', login_params " << login_params << LL_ENDL;
+
// Launch a coroutine with our login_() method. Run the coroutine until
// its first wait; at that point, return here.
std::string coroname =
LLCoros::instance().launch("LLLogin::Impl::login_",
- boost::bind(&Impl::login_, this, _1, uri, credentials));
+ boost::bind(&Impl::login_, this, _1, uri, login_params));
+ LL_DEBUGS("LLLogin") << " connected with uri '" << uri << "', login_params " << login_params << LL_ENDL;
}
-void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credentials)
+void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_params)
{
- LLSD printable_credentials = credentials;
- if(printable_credentials.has("params")
- && printable_credentials["params"].has("passwd"))
+ try
{
- printable_credentials["params"]["passwd"] = "*******";
- }
+ LLSD printable_params = login_params;
+ //if(printable_params.has("params")
+ // && printable_params["params"].has("passwd"))
+ //{
+ // printable_params["params"]["passwd"] = "*******";
+ //}
LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName(self)
- << " with uri '" << uri << "', credentials " << printable_credentials << LL_ENDL;
+ << " with uri '" << uri << "', parameters " << printable_params << LL_ENDL;
// Arriving in SRVRequest state
LLEventStream replyPump("SRVreply", true);
// Should be an array of one or more uri strings.
+
LLSD rewrittenURIs;
{
LLEventTimeout filter(replyPump);
@@ -155,9 +161,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
// *NOTE:Mani - Completely arbitrary default timeout value for SRV request.
F32 seconds_to_timeout = 5.0f;
- if(credentials.has("cfg_srv_timeout"))
+ if(login_params.has("cfg_srv_timeout"))
{
- seconds_to_timeout = credentials["cfg_srv_timeout"].asReal();
+ seconds_to_timeout = login_params["cfg_srv_timeout"].asReal();
}
// If the SRV request times out (e.g. EXT-3934), simulate response: an
@@ -167,9 +173,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
filter.eventAfter(seconds_to_timeout, fakeResponse);
std::string srv_pump_name = "LLAres";
- if(credentials.has("cfg_srv_pump"))
+ if(login_params.has("cfg_srv_pump"))
{
- srv_pump_name = credentials["cfg_srv_pump"].asString();
+ srv_pump_name = login_params["cfg_srv_pump"].asString();
}
// Make request
@@ -194,7 +200,7 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
urend(rewrittenURIs.endArray());
urit != urend; ++urit)
{
- LLSD request(credentials);
+ LLSD request(login_params);
request["reply"] = loginReplyPump.getName();
request["uri"] = *urit;
std::string status;
@@ -291,8 +297,17 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
// to success, add a data/message and data/reason fields.
LLSD error_response;
error_response["reason"] = mAuthResponse["status"];
+ error_response["errorcode"] = mAuthResponse["errorcode"];
error_response["message"] = mAuthResponse["error"];
+ if(mAuthResponse.has("certificate"))
+ {
+ error_response["certificate"] = mAuthResponse["certificate"];
+ }
sendProgressEvent("offline", "fail.login", error_response);
+ }
+ catch (...) {
+ llerrs << "login exception caught" << llendl;
+ }
}
void LLLogin::Impl::disconnect()
diff --git a/install.xml b/install.xml
index 651a6b9cf9..0c2fc60d3a 100644
--- a/install.xml
+++ b/install.xml
@@ -1112,9 +1112,9 @@ anguage Infrstructure (CLI) international standard</string>
<key>darwin</key>
<map>
<key>md5sum</key>
- <string>a7b49e0f3eedbd5de117a3524c414b3a</string>
+ <string>11d2be4f2b172430747b7d4a6739e3d8</string>
<key>url</key>
- <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/openSSL-0.9.7c-darwin-20080812.tar.bz2</uri>
+ <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/openSSL-0.9.8l-darwin-20100428.tar.bz2</uri>
</map>
<key>linux</key>
<map>