about summary refs log tree commit diff stats
path: root/src/config/accounts.h
Commit message (Expand)AuthorAgeFilesLines
* Applied coding style to account.hJames Booth2015-10-251-43/+43
* Force tls on all connections, add tls policy account propertyJames Booth2015-10-181-1/+2
* Add ability to script commands after connectJames Booth2015-10-151-0/+2
* Include last activity in initial presenceJames Booth2015-09-271-0/+1
* Added auto xa option, tidied autoaway codeJames Booth2015-09-271-0/+2
* Save last activity to account on disconnectJames Booth2015-09-251-0/+1
* Added pgpkeyid account setting, send signed presenceJames Booth2015-03-231-0/+2
* Updated copyrightJames Booth2015-02-101-1/+1
* Simplified autocompleters and command historyJames Booth2015-01-161-2/+2
* iofixedPeter Vilim2015-01-071-0/+1
* Add support for evaluated passwordPeter Vilim2015-01-061-0/+1
* Removed function pointersJames Booth2014-12-221-40/+38
* implement account removalWill Song2014-11-231-0/+1
* Added /account clear [account] portJames Booth2014-10-231-0/+1
* Added /account clear [account] serverJames Booth2014-10-231-0/+1
* Added license exemption for OpenSSL to source headersJames Booth2014-08-241-0/+12
* Added /otr policy for contacts in account preferencesJames Booth2014-05-111-0/+1
* Added otr to /account clear propertiesJames Booth2014-05-111-0/+1
* Added OTR policy account preferenceJames Booth2014-05-111-0/+1
* Updated copyrightJames Booth2014-03-091-1/+1
* Refactored ProfAccount creationJames Booth2014-01-221-22/+1
* Fixed test compilationJames Booth2014-01-181-1/+1
* WIP - Adding port to account optionsJames Booth2014-01-181-1/+3
* Added mock_accounts and fixed testsJames Booth2013-12-261-33/+35
* Moved fulljid logic to accountsJames Booth2013-12-151-0/+1
* Added clear command to /account for password clearingJames Booth2013-12-081-0/+1
* Added /account set <account> password <password>James Booth2013-11-071-0/+1
* Added MAX_PASSWORD_SIZE set to 64James Booth2013-11-071-0/+2
* Use passwords from the accounts fileTomás Senart2013-10-141-0/+1
* Allow users to set default muc service and nickname per accountJames Booth2013-09-121-0/+4
* Added rooms history to ProfAccountJames Booth2013-05-231-0/+1
* Added resource_presence_t and contact_presence_tJames Booth2013-02-101-3/+3
* Renamed jabber_presence_t->presence_tJames Booth2013-02-101-3/+3
* Added config dir to sourceJames Booth2013-02-021-0/+75
mages"` } var ( t time.Duration api string dump bool quiet bool random bool version bool pathOnly bool fetchOnly bool ) func main() { parseFlags() if version { cetus.Version() return } rand.Seed(time.Now().Unix()) // Convert timeout to seconds t = t * time.Second body, err := bpodBody() if dump { fmt.Println(body) return } bpod := bpod{} err = json.Unmarshal([]byte(body), &bpod) errChk("body unmarshal failed", err) // if random was set then bpodRes holds list of multiple // responses, choose a random response from the list var i int = rand.Intn(len(bpod.photos)) bpodPhoto := bpod.photos[i] // correct image path bpodPhoto.url = fmt.Sprintf("%s%s", "https://www.bing.com", bpodPhoto.url) // correct date format dt, err := time.Parse("20060102", bpodPhoto.startDate) errChk("bpodPhoto.startDate parse failed", err) bpodPhoto.startDate = dt.Format("2006-01-02") printDetails(bpodPhoto) // if fetchOnly is true then don't set background if fetchOnly { return } err = background.Set(bpodPhoto.url) errChk("setting background failed", err) } func parseFlags() { flag.BoolVar(&quiet, "quiet", false, "No output") flag.BoolVar(&version, "version", false, "Cetus version") flag.BoolVar(&fetchOnly, "fetch-only", false, "Don't set background, only fetch info") flag.BoolVar(&dump, "dump", false, "Only dump received response") flag.BoolVar(&random, "random", false, "Choose a random image (from 7 images)") flag.BoolVar(&pathOnly, "path-only", false, "Print only path of the image") flag.StringVar(&api, "api", "https://www.bing.com/HPImageArchive.aspx", "BPOD API URL") flag.DurationVar(&t, "timeout", 32*time.Second, "Timeout for http client in seconds") flag.Parse() } func printDetails(bpodPhoto photo) { if quiet { return } if pathOnly { cetus.PrintPath(bpodPhoto.url) return } fmt.Printf("Title: %s\n\n", bpodPhoto.title) fmt.Printf("Copyright: %s\n", bpodPhoto.copyright) fmt.Printf("Copyright Link: %s\n", bpodPhoto.copyrightLink) fmt.Printf("Date: %s\n\n", bpodPhoto.startDate) fmt.Printf("URL: %s\n", bpodPhoto.url) } func bpodBody() (string, error) { reqInfo := make(map[string]string) reqInfo["api"] = api if random { reqInfo["random"] = "true" } body, err := bing.GetBpodJson(reqInfo, t) return body, err } func errChk(ctx string, err error) { log.Println(ctx) log.Fatal(err) }