diff options
Diffstat (limited to 'go')
| -rw-r--r-- | go/main.go | 30 | 
1 files changed, 30 insertions, 0 deletions
| @@ -79,6 +79,7 @@ func (l *Limox) buttonCallback() {  	switch l.State {  	case Disconnected:  		log.Println("Starting connection establishment") +		go xmpp(l.JidEditor.Text(), l.PwdEditor.Text())  		l.State = Connecting  	case Connecting:  		log.Println("Aborted connection establishment") @@ -89,6 +90,35 @@ func (l *Limox) buttonCallback() {  	}  } +func xmpp(jid string, pwd string) { +	log.Printf("JID: '%s' PWD: '%s'\n", jid, pwd) +	log.Printf("Domain: '%s'\n", domainpart(jid)) +} + +// domainpart extracts the domain name from a JID / XMPP address. See +// https://datatracker.ietf.org/doc/html/rfc7622#section-3.2 for details. +func domainpart(jid string) string { +	list := []rune(jid) + +	for i, v := range(list) { +		if v == '/' { +			log.Printf("Index of / rune: %d\n", i) +			list = list[:i] +			break +		} +	} + +	for i, v := range(list) { +		if v == '@' { +			log.Printf("Index of @ rune: %d\n", i) +			list = list[i+1:] +			break +		} +	} + +	return string(list) +} +  func (l *Limox) draw(e system.FrameEvent) {  	gtx := layout.NewContext(&l.Operations, e) | 
