diff options
author | Sean Dague | 2008-04-10 13:53:06 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-10 13:53:06 +0000 |
commit | c176caeb05c2264654b764e4d010561da60c24fc (patch) | |
tree | 87e0cab128ecaac57c5995df4cf5048185fe383f /OpenSim/Data/SQLite | |
parent | * Brings back map tile generation based on the terrain. The algorithm produc... (diff) | |
download | opensim-SC_OLD-c176caeb05c2264654b764e4d010561da60c24fc.zip opensim-SC_OLD-c176caeb05c2264654b764e4d010561da60c24fc.tar.gz opensim-SC_OLD-c176caeb05c2264654b764e4d010561da60c24fc.tar.bz2 opensim-SC_OLD-c176caeb05c2264654b764e4d010561da60c24fc.tar.xz |
moved fields to properties for UserDataProfile, which was
actually a little more work than I expected given the copious
use of out params.
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserData.cs | 128 |
1 files changed, 66 insertions, 62 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index ad3d1a4..e395565 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -114,7 +114,7 @@ namespace OpenSim.Data.SQLite | |||
114 | row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(uuid)); | 114 | row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(uuid)); |
115 | if (row != null) | 115 | if (row != null) |
116 | { | 116 | { |
117 | user.currentAgent = buildUserAgent(row); | 117 | user.CurrentAgent = buildUserAgent(row); |
118 | } | 118 | } |
119 | return user; | 119 | return user; |
120 | } | 120 | } |
@@ -135,10 +135,10 @@ namespace OpenSim.Data.SQLite | |||
135 | if (rows.Length > 0) | 135 | if (rows.Length > 0) |
136 | { | 136 | { |
137 | UserProfileData user = buildUserProfile(rows[0]); | 137 | UserProfileData user = buildUserProfile(rows[0]); |
138 | DataRow row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(user.UUID)); | 138 | DataRow row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(user.Id)); |
139 | if (row != null) | 139 | if (row != null) |
140 | { | 140 | { |
141 | user.currentAgent = buildUserAgent(row); | 141 | user.CurrentAgent = buildUserAgent(row); |
142 | } | 142 | } |
143 | return user; | 143 | return user; |
144 | } | 144 | } |
@@ -297,7 +297,7 @@ namespace OpenSim.Data.SQLite | |||
297 | { | 297 | { |
298 | try | 298 | try |
299 | { | 299 | { |
300 | return GetUserByUUID(uuid).currentAgent; | 300 | return GetUserByUUID(uuid).CurrentAgent; |
301 | } | 301 | } |
302 | catch (Exception) | 302 | catch (Exception) |
303 | { | 303 | { |
@@ -325,7 +325,7 @@ namespace OpenSim.Data.SQLite | |||
325 | { | 325 | { |
326 | try | 326 | try |
327 | { | 327 | { |
328 | return GetUserByName(fname, lname).currentAgent; | 328 | return GetUserByName(fname, lname).CurrentAgent; |
329 | } | 329 | } |
330 | catch (Exception) | 330 | catch (Exception) |
331 | { | 331 | { |
@@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLite | |||
347 | else | 347 | else |
348 | { | 348 | { |
349 | UserProfileData user = GetUserByUUID(AgentID); | 349 | UserProfileData user = GetUserByUUID(AgentID); |
350 | user.webLoginKey = WebLoginKey; | 350 | user.WebLoginKey = WebLoginKey; |
351 | fillUserRow(row, user); | 351 | fillUserRow(row, user); |
352 | da.Update(ds, "users"); | 352 | da.Update(ds, "users"); |
353 | 353 | ||
@@ -365,7 +365,7 @@ namespace OpenSim.Data.SQLite | |||
365 | DataTable users = ds.Tables["users"]; | 365 | DataTable users = ds.Tables["users"]; |
366 | lock (ds) | 366 | lock (ds) |
367 | { | 367 | { |
368 | DataRow row = users.Rows.Find(Util.ToRawUuidString(user.UUID)); | 368 | DataRow row = users.Rows.Find(Util.ToRawUuidString(user.Id)); |
369 | if (row == null) | 369 | if (row == null) |
370 | { | 370 | { |
371 | row = users.NewRow(); | 371 | row = users.NewRow(); |
@@ -381,19 +381,19 @@ namespace OpenSim.Data.SQLite | |||
381 | // useragents table once the useragent is null | 381 | // useragents table once the useragent is null |
382 | // | 382 | // |
383 | // A database guy should look at this and figure out the best way to clear the useragents table. | 383 | // A database guy should look at this and figure out the best way to clear the useragents table. |
384 | if (user.currentAgent != null) | 384 | if (user.CurrentAgent != null) |
385 | { | 385 | { |
386 | DataTable ua = ds.Tables["useragents"]; | 386 | DataTable ua = ds.Tables["useragents"]; |
387 | row = ua.Rows.Find(Util.ToRawUuidString(user.UUID)); | 387 | row = ua.Rows.Find(Util.ToRawUuidString(user.Id)); |
388 | if (row == null) | 388 | if (row == null) |
389 | { | 389 | { |
390 | row = ua.NewRow(); | 390 | row = ua.NewRow(); |
391 | fillUserAgentRow(row, user.currentAgent); | 391 | fillUserAgentRow(row, user.CurrentAgent); |
392 | ua.Rows.Add(row); | 392 | ua.Rows.Add(row); |
393 | } | 393 | } |
394 | else | 394 | else |
395 | { | 395 | { |
396 | fillUserAgentRow(row, user.currentAgent); | 396 | fillUserAgentRow(row, user.CurrentAgent); |
397 | } | 397 | } |
398 | } | 398 | } |
399 | else | 399 | else |
@@ -401,7 +401,7 @@ namespace OpenSim.Data.SQLite | |||
401 | // I just added this to help the standalone login situation. | 401 | // I just added this to help the standalone login situation. |
402 | //It still needs to be looked at by a Database guy | 402 | //It still needs to be looked at by a Database guy |
403 | DataTable ua = ds.Tables["useragents"]; | 403 | DataTable ua = ds.Tables["useragents"]; |
404 | row = ua.Rows.Find(Util.ToRawUuidString(user.UUID)); | 404 | row = ua.Rows.Find(Util.ToRawUuidString(user.Id)); |
405 | 405 | ||
406 | if (row == null) | 406 | if (row == null) |
407 | { | 407 | { |
@@ -591,70 +591,74 @@ namespace OpenSim.Data.SQLite | |||
591 | // interesting has to be done to actually get these values | 591 | // interesting has to be done to actually get these values |
592 | // back out. Not enough time to figure it out yet. | 592 | // back out. Not enough time to figure it out yet. |
593 | UserProfileData user = new UserProfileData(); | 593 | UserProfileData user = new UserProfileData(); |
594 | LLUUID.TryParse((String)row["UUID"], out user.UUID); | 594 | LLUUID tmp; |
595 | user.username = (String) row["username"]; | 595 | LLUUID.TryParse((String)row["UUID"], out tmp); |
596 | user.surname = (String) row["surname"]; | 596 | user.Id = tmp; |
597 | user.passwordHash = (String) row["passwordHash"]; | 597 | user.FirstName = (String) row["username"]; |
598 | user.passwordSalt = (String) row["passwordSalt"]; | 598 | user.SurName = (String) row["surname"]; |
599 | 599 | user.PasswordHash = (String) row["passwordHash"]; | |
600 | user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]); | 600 | user.PasswordSalt = (String) row["passwordSalt"]; |
601 | user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]); | 601 | |
602 | user.homeLocation = new LLVector3( | 602 | user.HomeRegionX = Convert.ToUInt32(row["homeRegionX"]); |
603 | user.HomeRegionY = Convert.ToUInt32(row["homeRegionY"]); | ||
604 | user.HomeLocation = new LLVector3( | ||
603 | Convert.ToSingle(row["homeLocationX"]), | 605 | Convert.ToSingle(row["homeLocationX"]), |
604 | Convert.ToSingle(row["homeLocationY"]), | 606 | Convert.ToSingle(row["homeLocationY"]), |
605 | Convert.ToSingle(row["homeLocationZ"]) | 607 | Convert.ToSingle(row["homeLocationZ"]) |
606 | ); | 608 | ); |
607 | user.homeLookAt = new LLVector3( | 609 | user.HomeLookAt = new LLVector3( |
608 | Convert.ToSingle(row["homeLookAtX"]), | 610 | Convert.ToSingle(row["homeLookAtX"]), |
609 | Convert.ToSingle(row["homeLookAtY"]), | 611 | Convert.ToSingle(row["homeLookAtY"]), |
610 | Convert.ToSingle(row["homeLookAtZ"]) | 612 | Convert.ToSingle(row["homeLookAtZ"]) |
611 | ); | 613 | ); |
612 | user.created = Convert.ToInt32(row["created"]); | 614 | user.Created = Convert.ToInt32(row["created"]); |
613 | user.lastLogin = Convert.ToInt32(row["lastLogin"]); | 615 | user.LastLogin = Convert.ToInt32(row["lastLogin"]); |
614 | user.rootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]); | 616 | user.RootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]); |
615 | user.userInventoryURI = (String) row["userInventoryURI"]; | 617 | user.UserInventoryURI = (String) row["userInventoryURI"]; |
616 | user.userAssetURI = (String) row["userAssetURI"]; | 618 | user.UserAssetURI = (String) row["userAssetURI"]; |
617 | user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); | 619 | user.ProfileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); |
618 | user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); | 620 | user.ProfileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); |
619 | user.profileAboutText = (String) row["profileAboutText"]; | 621 | user.ProfileAboutText = (String) row["profileAboutText"]; |
620 | user.profileFirstText = (String) row["profileFirstText"]; | 622 | user.ProfileFirstText = (String) row["profileFirstText"]; |
621 | LLUUID.TryParse((String)row["profileImage"], out user.profileImage); | 623 | LLUUID.TryParse((String)row["profileImage"], out tmp); |
622 | LLUUID.TryParse((String)row["profileFirstImage"], out user.profileFirstImage); | 624 | user.ProfileImage = tmp; |
623 | user.webLoginKey = new LLUUID((String) row["webLoginKey"]); | 625 | LLUUID.TryParse((String)row["profileFirstImage"], out tmp); |
626 | user.ProfileFirstImage = tmp; | ||
627 | user.WebLoginKey = new LLUUID((String) row["webLoginKey"]); | ||
624 | 628 | ||
625 | return user; | 629 | return user; |
626 | } | 630 | } |
627 | 631 | ||
628 | private void fillUserRow(DataRow row, UserProfileData user) | 632 | private void fillUserRow(DataRow row, UserProfileData user) |
629 | { | 633 | { |
630 | row["UUID"] = Util.ToRawUuidString(user.UUID); | 634 | row["UUID"] = Util.ToRawUuidString(user.Id); |
631 | row["username"] = user.username; | 635 | row["username"] = user.FirstName; |
632 | row["surname"] = user.surname; | 636 | row["surname"] = user.SurName; |
633 | row["passwordHash"] = user.passwordHash; | 637 | row["passwordHash"] = user.PasswordHash; |
634 | row["passwordSalt"] = user.passwordSalt; | 638 | row["passwordSalt"] = user.PasswordSalt; |
635 | 639 | ||
636 | 640 | ||
637 | row["homeRegionX"] = user.homeRegionX; | 641 | row["homeRegionX"] = user.HomeRegionX; |
638 | row["homeRegionY"] = user.homeRegionY; | 642 | row["homeRegionY"] = user.HomeRegionY; |
639 | row["homeLocationX"] = user.homeLocation.X; | 643 | row["homeLocationX"] = user.HomeLocation.X; |
640 | row["homeLocationY"] = user.homeLocation.Y; | 644 | row["homeLocationY"] = user.HomeLocation.Y; |
641 | row["homeLocationZ"] = user.homeLocation.Z; | 645 | row["homeLocationZ"] = user.HomeLocation.Z; |
642 | row["homeLookAtX"] = user.homeLookAt.X; | 646 | row["homeLookAtX"] = user.HomeLookAt.X; |
643 | row["homeLookAtY"] = user.homeLookAt.Y; | 647 | row["homeLookAtY"] = user.HomeLookAt.Y; |
644 | row["homeLookAtZ"] = user.homeLookAt.Z; | 648 | row["homeLookAtZ"] = user.HomeLookAt.Z; |
645 | 649 | ||
646 | row["created"] = user.created; | 650 | row["created"] = user.Created; |
647 | row["lastLogin"] = user.lastLogin; | 651 | row["lastLogin"] = user.LastLogin; |
648 | row["rootInventoryFolderID"] = user.rootInventoryFolderID; | 652 | row["rootInventoryFolderID"] = user.RootInventoryFolderID; |
649 | row["userInventoryURI"] = user.userInventoryURI; | 653 | row["userInventoryURI"] = user.UserInventoryURI; |
650 | row["userAssetURI"] = user.userAssetURI; | 654 | row["userAssetURI"] = user.UserAssetURI; |
651 | row["profileCanDoMask"] = user.profileCanDoMask; | 655 | row["profileCanDoMask"] = user.ProfileCanDoMask; |
652 | row["profileWantDoMask"] = user.profileWantDoMask; | 656 | row["profileWantDoMask"] = user.ProfileWantDoMask; |
653 | row["profileAboutText"] = user.profileAboutText; | 657 | row["profileAboutText"] = user.ProfileAboutText; |
654 | row["profileFirstText"] = user.profileFirstText; | 658 | row["profileFirstText"] = user.ProfileFirstText; |
655 | row["profileImage"] = user.profileImage; | 659 | row["profileImage"] = user.ProfileImage; |
656 | row["profileFirstImage"] = user.profileFirstImage; | 660 | row["profileFirstImage"] = user.ProfileFirstImage; |
657 | row["webLoginKey"] = user.webLoginKey; | 661 | row["webLoginKey"] = user.WebLoginKey; |
658 | 662 | ||
659 | // ADO.NET doesn't handle NULL very well | 663 | // ADO.NET doesn't handle NULL very well |
660 | foreach (DataColumn col in ds.Tables["users"].Columns) | 664 | foreach (DataColumn col in ds.Tables["users"].Columns) |