Member Export now done

This commit is contained in:
2026-02-26 18:19:40 -07:00
parent 344562c55c
commit 9dc4dd2ec4
5 changed files with 159 additions and 152 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ _(italicized items can be deferred)_
- ~~Community Profile: Invite~~ - ~~Community Profile: Invite~~
- _Help link atop page headers_ - _Help link atop page headers_
- _Policy page_ - _Policy page_
- Member List: Export - ~~Member List: Export~~
- ~~HTML reference for post boxes~~ - ~~HTML reference for post boxes~~
- ~~Posts view:~~ - ~~Posts view:~~
- ~~Find~~ - ~~Find~~
+135 -125
View File
@@ -23,119 +23,128 @@ import (
* https://xmpp.org/extensions/xep-0054.html. * https://xmpp.org/extensions/xep-0054.html.
*/ */
// Used to indicate a field which may be present, or not.
type Presence struct{}
// Specifies that a "present" field is "present."
var Present = &Presence{}
// The vCard version field.
const VCARD_VERSION = "2.0"
// VCard is the top level vCard structure. // VCard is the top level vCard structure.
type VCard struct { type VCard struct {
XMLName xml.Name `xml:"vcard-temp vCard"` // name must be "vCard" in the "vcard-temp" namespace XMLName xml.Name `xml:"vcard-temp vCard"` // name must be "vCard" in the "vcard-temp" namespace
Version string `xml:"VERSION"` // vCard version number Version string `xml:"VERSION"` // vCard version number
FullName string `xml:"FN"` // full name FullName string `xml:"FN"` // full name
Name VCName `xml:"N"` // broken-up name components Name VCName `xml:"N"` // broken-up name components
Nickname string `xml:"NICKNAME"` // nickname (not used in Amsterdam) Nickname string `xml:"NICKNAME,omitempty"` // nickname (not used in Amsterdam)
Photo *VCPhoto `xml:"PHOTO"` // user photo (not used in Amsterdam) Photo *VCPhoto `xml:"PHOTO,omitempty"` // user photo (not used in Amsterdam)
BDay string `xml:"BDAY"` // birthday, ISO 8601 format BDay string `xml:"BDAY,omitempty"` // birthday, ISO 8601 format
Address *[]VCAddress `xml:"ADR"` // address Address *[]VCAddress `xml:"ADR,omitempty"` // address
AddressLabel *[]VCAddressLabel `xml:"LABEL"` // address label AddressLabel *[]VCAddressLabel `xml:"LABEL,omitempty"` // address label
Email *[]VCEmail `xml:"EMAIL"` // E-mail address Email *[]VCEmail `xml:"EMAIL,omitempty"` // E-mail address
Tel *[]VCTelephone `xml:"TEL"` // telephone number Tel *[]VCTelephone `xml:"TEL,omitempty"` // telephone number
JabberID string `xml:"JABBERID"` // Jabber/XMPP address (user@host) (XMPP extension) (not used in Amsterdam) JabberID string `xml:"JABBERID,omitempty"` // Jabber/XMPP address (user@host) (XMPP extension) (not used in Amsterdam)
Mailer string `xml:"MAILER"` // mailer user agent (not used in Amsterdam) Mailer string `xml:"MAILER,omitempty"` // mailer user agent (not used in Amsterdam)
TZ string `xml:"TZ"` // time zone indicator, ISO 8601 formatted UTC offset TZ string `xml:"TZ,omitempty"` // time zone indicator, ISO 8601 formatted UTC offset
Geolocation *VCGeolocation `xml:"GEO"` // geolocation (not used in Amsterdam) Geolocation *VCGeolocation `xml:"GEO,omitempty"` // geolocation (not used in Amsterdam)
Title string `xml:"TITLE"` // job title (not used in Amsterdam) Title string `xml:"TITLE,omitempty"` // job title (not used in Amsterdam)
Role string `xml:"ROLE"` // job role (not used in Amsterdam) Role string `xml:"ROLE,omitempty"` // job role (not used in Amsterdam)
Logo *VCLogo `xml:"LOGO"` // organization logo (not used in Amsterdam) Logo *VCLogo `xml:"LOGO,omitempty"` // organization logo (not used in Amsterdam)
Agent *VCAgent `xml:"AGENT"` // agent for the organization (not used in Amsterdam) Agent *VCAgent `xml:"AGENT,omitempty"` // agent for the organization (not used in Amsterdam)
Org *VCOrganization `xml:"ORG"` // organization Org *VCOrganization `xml:"ORG,omitempty"` // organization
Categories *VCCategory `xml:"CATEGORIES"` // categories Categories *VCCategory `xml:"CATEGORIES,omitempty"` // categories
Note string `xml:"NOTE"` // text note (not used by Amsterdam) Note string `xml:"NOTE,omitempty"` // text note (not used by Amsterdam)
ProductID string `xml:"PRODID"` // product ID that generated this vCard (not used by Amsterdam) ProductID string `xml:"PRODID,omitempty"` // product ID that generated this vCard (not used by Amsterdam)
LastUpdate string `xml:"REV"` // last update to this information, ISO 8601 format LastUpdate string `xml:"REV,omitempty"` // last update to this information, ISO 8601 format
SortString string `xml:"SORT-STRING"` // sort string SortString string `xml:"SORT-STRING,omitempty"` // sort string
Sound *VCSound `xml:"SOUND"` // pronunciation property (not used in Amsterdam) Sound *VCSound `xml:"SOUND,omitempty"` // pronunciation property (not used in Amsterdam)
UID string `xml:"UID"` // unique identifier (not necessarily an Amsterdam UID!) (not used in Amsterdam) UID string `xml:"UID,omitempty"` // unique identifier (not necessarily an Amsterdam UID!) (not used in Amsterdam)
URL string `xml:"URL"` // URL URL string `xml:"URL,omitempty"` // URL
Class *VCClass `xml:"CLASS"` // privacy classification (not used in Amsterdam) Class *VCClass `xml:"CLASS,omitempty"` // privacy classification (not used in Amsterdam)
Key *VCKey `xml:"KEY"` // authentication credential or encryption key (not used in Amsterdam) Key *VCKey `xml:"KEY,omitempty"` // authentication credential or encryption key (not used in Amsterdam)
Description string `xml:"DESC"` // description string value (XMPP extension) Description string `xml:"DESC,omitempty"` // description string value (XMPP extension)
} }
// VCPhoto is the "photo" attachment to the VCard. // VCPhoto is the "photo" attachment to the VCard.
type VCPhoto struct { type VCPhoto struct {
XMLName xml.Name `xml:"PHOTO"` // must be a "PHOTO" tag XMLName xml.Name `xml:"PHOTO"` // must be a "PHOTO" tag
Type string `xml:"TYPE"` // data type for BINVAL Type string `xml:"TYPE,omitempty"` // data type for BINVAL
BinaryValue string `xml:"BINVAL"` // binary photo value (Base64 encoded) BinaryValue string `xml:"BINVAL,omitempty"` // binary photo value (Base64 encoded)
ExternalValue string `xml:"EXTVAL"` // external value of photo (URL) ExternalValue string `xml:"EXTVAL,omitempty"` // external value of photo (URL)
} }
// Name is the "structured name" property of the vCard. // Name is the "structured name" property of the vCard.
type VCName struct { type VCName struct {
XMLName xml.Name `xml:"N"` // must be an "N" tag XMLName xml.Name `xml:"N"` // must be an "N" tag
Family string `xml:"FAMILY"` // family name Family string `xml:"FAMILY,omitempty"` // family name
Given string `xml:"GIVEN"` // given name Given string `xml:"GIVEN,omitempty"` // given name
Middle string `xml:"MIDDLE"` // middle name/initial Middle string `xml:"MIDDLE,omitempty"` // middle name/initial
Prefix string `xml:"PREFIX"` // prefix Prefix string `xml:"PREFIX,omitempty"` // prefix
Suffix string `xml:"SUFFIX"` // suffix Suffix string `xml:"SUFFIX,omitempty"` // suffix
} }
// VCAddress is the "address" property of the vCard. // VCAddress is the "address" property of the vCard.
type VCAddress struct { type VCAddress struct {
XMLName xml.Name `xml:"ADR"` // must be a "ADR" tag XMLName xml.Name `xml:"ADR"` // must be a "ADR" tag
Work xml.Name `xml:"WORK"` // Presence indicates work address Work *Presence `xml:"WORK,omitempty"` // Presence indicates work address
Home xml.Name `xml:"HOME"` // Presence indicates home address Home *Presence `xml:"HOME,omitempty"` // Presence indicates home address
Postal xml.Name `xml:"POSTAL"` // presence indicates postal address Postal *Presence `xml:"POSTAL,omitempty"` // presence indicates postal address
Parcel xml.Name `xml:"PARCEL"` // presence indicates parcel address Parcel *Presence `xml:"PARCEL,omitempty"` // presence indicates parcel address
Domestic xml.Name `xml:"DOM"` // presence indicates domestic address Domestic *Presence `xml:"DOM,omitempty"` // presence indicates domestic address
International xml.Name `xml:"INTL"` // presence indicates international address International *Presence `xml:"INTL,omitempty"` // presence indicates international address
Preferred xml.Name `xml:"PREF"` // Presence indicates preferred address Preferred *Presence `xml:"PREF,omitempty"` // Presence indicates preferred address
POBox string `xml:"POBOX"` // post office box POBox string `xml:"POBOX,omitempty"` // post office box
Locality string `xml:"LOCALITY"` // locality (city) Locality string `xml:"LOCALITY,omitempty"` // locality (city)
Region string `xml:"REGION"` // region (state/province) Region string `xml:"REGION,omitempty"` // region (state/province)
PCode string `xml:"PCODE"` // postal code PCode string `xml:"PCODE,omitempty"` // postal code
Country string `xml:"CTRY"` // country Country string `xml:"CTRY,omitempty"` // country
Street string `xml:"STREET"` // street address (addr line 1) Street string `xml:"STREET,omitempty"` // street address (addr line 1)
ExtAddr string `xml:"EXTADR"` // extended address (addr line 2) ExtAddr string `xml:"EXTADR,omitempty"` // extended address (addr line 2)
} }
// VCAddressLabel is the "address label" property of the vCard. // VCAddressLabel is the "address label" property of the vCard.
type VCAddressLabel struct { type VCAddressLabel struct {
XMLName xml.Name `xml:"LABEL"` // must be a "LABEL" tag XMLName xml.Name `xml:"LABEL"` // must be a "LABEL" tag
Work xml.Name `xml:"WORK"` // Presence indicates work address Work *Presence `xml:"WORK,omitempty"` // Presence indicates work address
Home xml.Name `xml:"HOME"` // Presence indicates home address Home *Presence `xml:"HOME,omitempty"` // Presence indicates home address
Postal xml.Name `xml:"POSTAL"` // presence indicates postal address Postal *Presence `xml:"POSTAL,omitempty"` // presence indicates postal address
Parcel xml.Name `xml:"PARCEL"` // presence indicates parcel address Parcel *Presence `xml:"PARCEL,omitempty"` // presence indicates parcel address
Domestic xml.Name `xml:"DOM"` // presence indicates domestic address Domestic *Presence `xml:"DOM,omitempty"` // presence indicates domestic address
International xml.Name `xml:"INTL"` // presence indicates international address International *Presence `xml:"INTL,omitempty"` // presence indicates international address
Preferred xml.Name `xml:"PREF"` // Presence indicates preferred address Preferred *Presence `xml:"PREF,omitempty"` // Presence indicates preferred address
Lines []string `xml:"LINE"` // lines of text on the address label Lines []string `xml:"LINE"` // lines of text on the address label
} }
// VCEmail is the "E-mail address" property of the vCard. // VCEmail is the "E-mail address" property of the vCard.
type VCEmail struct { type VCEmail struct {
XMLName xml.Name `xml:"EMAIL"` // must be an "EMAIL" tag XMLName xml.Name `xml:"EMAIL"` // must be an "EMAIL" tag
Work xml.Name `xml:"WORK"` // presence indicates work address Work *Presence `xml:"WORK,omitempty"` // presence indicates work address
Home xml.Name `xml:"HOME"` // presence indicates home address Home *Presence `xml:"HOME,omitempty"` // presence indicates home address
Internet xml.Name `xml:"INTERNET"` // presence indicates Internet address Internet *Presence `xml:"INTERNET,omitempty"` // presence indicates Internet address
Preferred xml.Name `xml:"PREF"` // Presence indicates preferred address Preferred *Presence `xml:"PREF,omitempty"` // Presence indicates preferred address
X400 xml.Name `xml:"X400"` // Presence indicates X.400 address X400 *Presence `xml:"X400,omitempty"` // Presence indicates X.400 address
UserID string `xml:"USERID"` // user ID (address) UserID string `xml:"USERID"` // user ID (address)
} }
// VCTelephone is the "telephone number" property of the vCard. // VCTelephone is the "telephone number" property of the vCard.
type VCTelephone struct { type VCTelephone struct {
XMLName xml.Name `xml:"TEL"` // must be a "TEL" tag XMLName xml.Name `xml:"TEL"` // must be a "TEL" tag
Work xml.Name `xml:"WORK"` // presence indicates work number Work *Presence `xml:"WORK,omitempty"` // presence indicates work number
Home xml.Name `xml:"HOME"` // presence indicates home number Home *Presence `xml:"HOME,omitempty"` // presence indicates home number
Voice xml.Name `xml:"VOICE"` // presence indicates voice number Voice *Presence `xml:"VOICE,omitempty"` // presence indicates voice number
Fax xml.Name `xml:"FAX"` // presence indicates fax number Fax *Presence `xml:"FAX,omitempty"` // presence indicates fax number
Pager xml.Name `xml:"PAGER"` // presence indicates pager number Pager *Presence `xml:"PAGER,omitempty"` // presence indicates pager number
Message xml.Name `xml:"MSG"` // presence indicates message number Message *Presence `xml:"MSG,omitempty"` // presence indicates message number
Cell xml.Name `xml:"CELL"` // presence indicates cellphone number Cell *Presence `xml:"CELL,omitempty"` // presence indicates cellphone number
Video xml.Name `xml:"VIDEO"` // presence indicates videophone number Video *Presence `xml:"VIDEO,omitempty"` // presence indicates videophone number
BBS xml.Name `xml:"BBS"` // presence indicates BBS number BBS *Presence `xml:"BBS,omitempty"` // presence indicates BBS number
Modem xml.Name `xml:"MODEM"` // presence indicates modem number Modem *Presence `xml:"MODEM,omitempty"` // presence indicates modem number
ISDN xml.Name `xml:"ISDN"` // presence indicates ISDN number ISDN *Presence `xml:"ISDN,omitempty"` // presence indicates ISDN number
PCS xml.Name `xml:"PCS"` // presence indicates PCS number PCS *Presence `xml:"PCS,omitempty"` // presence indicates PCS number
Preferred xml.Name `xml:"PREF"` // presence indicates preferred number Preferred *Presence `xml:"PREF,omitempty"` // presence indicates preferred number
Number string `xml:"NUMBER"` // the number Number string `xml:"NUMBER"` // the number
} }
// VCGeolocation is the "geolocation" property of the vCard. // VCGeolocation is the "geolocation" property of the vCard.
@@ -147,24 +156,24 @@ type VCGeolocation struct {
// VCLogo is the "logo" property of the vCard. // VCLogo is the "logo" property of the vCard.
type VCLogo struct { type VCLogo struct {
XMLName xml.Name `xml:"LOGO"` // must be a "LOGO" tag XMLName xml.Name `xml:"LOGO"` // must be a "LOGO" tag
Type string `xml:"TYPE"` // data type for BINVAL Type string `xml:"TYPE,omitempty"` // data type for BINVAL
BinaryValue string `xml:"BINVAL"` // binary photo value (Base64 encoded) BinaryValue string `xml:"BINVAL,omitempty"` // binary photo value (Base64 encoded)
ExternalValue string `xml:"EXTVAL"` // external value of photo (URL) ExternalValue string `xml:"EXTVAL,omitempty"` // external value of photo (URL)
} }
// VCAgent is the "agent" property of the vCard. // VCAgent is the "agent" property of the vCard.
type VCAgent struct { type VCAgent struct {
XMLName xml.Name `xml:"AGENT"` // must be an "AGENT" tag XMLName xml.Name `xml:"AGENT"` // must be an "AGENT" tag
VCard *VCard `xml:"vcard-temp vCard"` // vCard with agent contact info VCard *VCard `xml:"vcard-temp vCard,omitempty"` // vCard with agent contact info
ExternalValue string `xml:"EXTVAL"` // external value, such as URL to contact info ExternalValue string `xml:"EXTVAL,omitempty"` // external value, such as URL to contact info
} }
// VCOrganization is the "organization" property of the vCard. // VCOrganization is the "organization" property of the vCard.
type VCOrganization struct { type VCOrganization struct {
XMLName xml.Name `xml:"ORG"` // must be an "ORG" tag XMLName xml.Name `xml:"ORG"` // must be an "ORG" tag
OrgName string `xml:"ORGNAME"` // organization name OrgName string `xml:"ORGNAME"` // organization name
OrgUnit *[]string `xml:"ORGUNIT"` // organization unit(s) OrgUnit *[]string `xml:"ORGUNIT,omitempty"` // organization unit(s)
} }
// VCCategory is the "category" property of the vCard. // VCCategory is the "category" property of the vCard.
@@ -175,29 +184,30 @@ type VCCategory struct {
// VCSound is the "pronunciation guide" property of the vCard. // VCSound is the "pronunciation guide" property of the vCard.
type VCSound struct { type VCSound struct {
XMLName xml.Name `xml:"SOUND"` // must be a "SOUND" tag XMLName xml.Name `xml:"SOUND"` // must be a "SOUND" tag
Phonetic string `xml:"PHONETIC"` // phonetic pronunciation Phonetic string `xml:"PHONETIC,omitempty"` // phonetic pronunciation
BinaryValue string `xml:"BINVAL"` // binary audio value (Base64 encoded) BinaryValue string `xml:"BINVAL,omitempty"` // binary audio value (Base64 encoded)
ExternalValue string `xml:"EXTVAL"` // external value of audio (URL) ExternalValue string `xml:"EXTVAL,omitempty"` // external value of audio (URL)
} }
// VCClass is the "privacy classification" property of the vCard. // VCClass is the "privacy classification" property of the vCard.
type VCClass struct { type VCClass struct {
XMLName xml.Name `xml:"CLASS"` // must be a "CLASS" tag XMLName xml.Name `xml:"CLASS"` // must be a "CLASS" tag
Public xml.Name `xml:"PUBLIC"` // presence indicates public information Public *Presence `xml:"PUBLIC,omitempty"` // presence indicates public information
Private xml.Name `xml:"PRIVATE"` // presence indicates private information Private *Presence `xml:"PRIVATE,omitempty"` // presence indicates private information
Confidential xml.Name `xml:"CONFIDENTIAL"` // presence indicates confidential information Confidential *Presence `xml:"CONFIDENTIAL,omitempty"` // presence indicates confidential information
} }
// VCKey is the "authentication or encryption key" property of the vCard. // VCKey is the "authentication or encryption key" property of the vCard.
type VCKey struct { type VCKey struct {
XMLName xml.Name `xml:"KEY"` // must be a "KEY" tag XMLName xml.Name `xml:"KEY"` // must be a "KEY" tag
Type string `xml:"TYPE"` // type indicator Type string `xml:"TYPE,omitempty"` // type indicator
Credential string `xml:"CRED"` // credential value Credential string `xml:"CRED"` // credential value
} }
// VCardFromContactInfo fills in a VCard structure from a ContactInfo object.
func VCardFromContactInfo(ctx context.Context, target *VCard, ci *database.ContactInfo) error { func VCardFromContactInfo(ctx context.Context, target *VCard, ci *database.ContactInfo) error {
target.Version = "2.0" target.Version = VCARD_VERSION
target.FullName = ci.FullName(false) target.FullName = ci.FullName(false)
target.Name.Family = util.SRef(ci.FamilyName) target.Name.Family = util.SRef(ci.FamilyName)
target.Name.Given = util.SRef(ci.GivenName) target.Name.Given = util.SRef(ci.GivenName)
@@ -210,9 +220,9 @@ func VCardFromContactInfo(ctx context.Context, target *VCard, ci *database.Conta
} }
addr := make([]VCAddress, 1) addr := make([]VCAddress, 1)
addr[0].Home.Local = "HOME" addr[0].Home = Present
addr[0].Postal.Local = "POSTAL" addr[0].Postal = Present
addr[0].Preferred.Local = "PREF" addr[0].Preferred = Present
addr[0].Street = util.SRef(ci.Addr1) addr[0].Street = util.SRef(ci.Addr1)
addr[0].ExtAddr = util.SRef(ci.Addr2) addr[0].ExtAddr = util.SRef(ci.Addr2)
addr[0].Locality = util.SRef(ci.Locality) addr[0].Locality = util.SRef(ci.Locality)
@@ -226,24 +236,24 @@ func VCardFromContactInfo(ctx context.Context, target *VCard, ci *database.Conta
phone := make([]VCTelephone, phcount) phone := make([]VCTelephone, phcount)
i := 0 i := 0
if ci.Phone != nil { if ci.Phone != nil {
phone[i].Home.Local = "HOME" phone[i].Home = Present
phone[i].Voice.Local = "VOICE" phone[i].Voice = Present
phone[i].Preferred.Local = "PREF" phone[i].Preferred = Present
phone[i].Number = *ci.Phone phone[i].Number = *ci.Phone
i++ i++
} }
if ci.Fax != nil { if ci.Fax != nil {
phone[i].Home.Local = "HOME" phone[i].Home = Present
phone[i].Fax.Local = "FAX" phone[i].Fax = Present
phone[i].Preferred.Local = "PREF" phone[i].Preferred = Present
phone[i].Number = *ci.Fax phone[i].Number = *ci.Fax
i++ i++
} }
if ci.Mobile != nil { if ci.Mobile != nil {
phone[i].Home.Local = "HOME" phone[i].Home = Present
phone[i].Cell.Local = "CELL" phone[i].Cell = Present
phone[i].Voice.Local = "VOICE" phone[i].Voice = Present
phone[i].Preferred.Local = "PREF" phone[i].Preferred = Present
phone[i].Number = *ci.Mobile phone[i].Number = *ci.Mobile
i++ i++
} }
@@ -256,9 +266,9 @@ func VCardFromContactInfo(ctx context.Context, target *VCard, ci *database.Conta
if ci.Email != nil { if ci.Email != nil {
email := make([]VCEmail, 1) email := make([]VCEmail, 1)
email[0].Home.Local = "HOME" email[0].Home = Present
email[0].Internet.Local = "INTERNET" email[0].Internet = Present
email[0].Preferred.Local = "PREF" email[0].Preferred = Present
email[0].UserID = *ci.Email email[0].UserID = *ci.Email
target.Email = &email target.Email = &email
} }
+12 -12
View File
@@ -49,18 +49,18 @@ type VCIFTopic struct {
// VCIFPost is the VCIF element representing a post in a topic. // VCIFPost is the VCIF element representing a post in a topic.
type VCIFPost struct { type VCIFPost struct {
XMLName xml.Name `xml:"post"` // I am the <post> element XMLName xml.Name `xml:"post"` // I am the <post> element
ID int64 `xml:"id,attr"` // post ID (PostId) ID int64 `xml:"id,attr"` // post ID (PostId)
Parent int64 `xml:"parent,attr"` // parent PostId (usually 0) Parent int64 `xml:"parent,attr"` // parent PostId (usually 0)
Index int `xml:"index,attr"` // post index (number) Index int `xml:"index,attr"` // post index (number)
Lines int `xml:"lines,attr"` // line count Lines int `xml:"lines,attr"` // line count
Author string `xml:"author,attr"` // author username Author string `xml:"author,attr"` // author username
DateISO8601 string `xml:"date,attr"` // post date, ISO 8601 format DateISO8601 string `xml:"date,attr"` // post date, ISO 8601 format
Hidden bool `xml:"hidden,attr"` // is post hidden? Hidden bool `xml:"hidden,attr"` // is post hidden?
Scribbled *VCIFScribble `xml:"scribbled"` // is post scribbled? Scribbled *VCIFScribble `xml:"scribbled,omitempty"` // is post scribbled?
Pseud string `xml:"pseud"` // post pseud Pseud string `xml:"pseud"` // post pseud
Text string `xml:"text"` // post text Text string `xml:"text"` // post text
Attachment *VCIFPostAttachment `xml:"attachment"` // attachment data Attachment *VCIFPostAttachment `xml:"attachment,omitempty"` // attachment data
} }
// VCIFScribble is the VCIF element representing that a post has been scribbled. // VCIFScribble is the VCIF element representing that a post has been scribbled.
+9 -9
View File
@@ -33,15 +33,15 @@ type VIUBase struct {
// VIUUser is the structure representing a single user. // VIUUser is the structure representing a single user.
type VIUUser struct { type VIUUser struct {
XMLName xml.Name `xml:"venice-user"` // must be a <venice-user> tag XMLName xml.Name `xml:"venice-user"` // must be a <venice-user> tag
ID int `xml:"id,attr"` // the UID for the user ID int `xml:"id,attr"` // the UID for the user
Username string `xml:"username"` // user name Username string `xml:"username"` // user name
Password VIUPassword `xml:"password"` // password information Password VIUPassword `xml:"password,omitempty"` // password information
PasswordReminder string `xml:"password-reminder"` // password reminder string PasswordReminder string `xml:"password-reminder,omitempty"` // password reminder string
Description string `xml:"description"` // description string Description string `xml:"description,omitempty"` // description string
Options VIUOptions `xml:"options"` // user options Options VIUOptions `xml:"options"` // user options
VCard VCard `xml:"vcard-temp vCard"` // user contact info in vCard XML format VCard VCard `xml:"vcard-temp vCard"` // user contact info in vCard XML format
Joins []VIUCommunityJoin `xml:"join"` // joined communities Joins []VIUCommunityJoin `xml:"join,omitempty"` // joined communities
} }
// VIUPassword represents the user password information. // VIUPassword represents the user password information.
+2 -5
View File
@@ -23,6 +23,7 @@ import (
"git.erbosoft.com/amy/amsterdam/config" "git.erbosoft.com/amy/amsterdam/config"
"git.erbosoft.com/amy/amsterdam/database" "git.erbosoft.com/amy/amsterdam/database"
"git.erbosoft.com/amy/amsterdam/util"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
@@ -212,11 +213,7 @@ func (fld *DialogItem) ValPtr() *string {
// SetVal sets the value of a field from a string pointer. // SetVal sets the value of a field from a string pointer.
func (fld *DialogItem) SetVal(p *string) { func (fld *DialogItem) SetVal(p *string) {
if p == nil { fld.Value = util.SRef(p)
fld.Value = ""
} else {
fld.Value = *p
}
} }
// SetInt sets the value of a field to an integer. // SetInt sets the value of a field to an integer.