Compare commits
	
		
			9 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 3450fbc78f | ||
|   | 48ad9ce669 | ||
|   | fd676f13cf | ||
|   | 63b5f3a604 | ||
|   | b20031ff6a | ||
|   | 00516c3191 | ||
|   | 76c4010ce2 | ||
|   | 0b8d265024 | ||
|   | 80825b0dff | 
							
								
								
									
										12
									
								
								.github/FUNDING.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.github/FUNDING.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| # These are supported funding model platforms | ||||
|  | ||||
| github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||||
| open_collective: #normen | ||||
| ko_fi: normen | ||||
| patreon: #normen | ||||
| tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||||
| community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||||
| liberapay: # Replace with a single Liberapay username | ||||
| issuehunt: # Replace with a single IssueHunt username | ||||
| otechie: # Replace with a single Otechie username | ||||
| custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] | ||||
| @@ -20,6 +20,20 @@ func InitConfig() { | ||||
| 	if configFilePath, err = xdg.ConfigFile("whatscli/whatscli.config"); err == nil { | ||||
| 		if cfg, err = ini.Load(configFilePath); err == nil { | ||||
| 			//TODO: check config for new parameters | ||||
| 			if section, err := cfg.GetSection("colors"); err == nil { | ||||
| 				if _, err := section.GetKey("borders"); err != nil { | ||||
| 					section.NewKey("borders", "white") | ||||
| 					err = cfg.SaveTo(configFilePath) | ||||
| 				} | ||||
| 				if _, err := section.GetKey("input_background"); err != nil { | ||||
| 					section.NewKey("input_background", "blue") | ||||
| 					err = cfg.SaveTo(configFilePath) | ||||
| 				} | ||||
| 				if _, err := section.GetKey("input_text"); err != nil { | ||||
| 					section.NewKey("input_text", "white") | ||||
| 					err = cfg.SaveTo(configFilePath) | ||||
| 				} | ||||
| 			} | ||||
| 		} else { | ||||
| 			cfg = ini.Empty() | ||||
| 			cfg.NewSection("general") | ||||
| @@ -47,6 +61,9 @@ func InitConfig() { | ||||
| 			cfg.Section("colors").NewKey("list_group", "blue") | ||||
| 			cfg.Section("colors").NewKey("chat_contact", "green") | ||||
| 			cfg.Section("colors").NewKey("chat_me", "blue") | ||||
| 			cfg.Section("colors").NewKey("borders", "white") | ||||
| 			cfg.Section("colors").NewKey("input_background", "blue") | ||||
| 			cfg.Section("colors").NewKey("input_text", "white") | ||||
| 			err = cfg.SaveTo(configFilePath) | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										6
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								go.sum
									
									
									
									
									
								
							| @@ -17,8 +17,6 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m | ||||
| github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= | ||||
| github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= | ||||
| github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= | ||||
| github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU= | ||||
| github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0= | ||||
| github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= | ||||
| github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591 h1:0WWUDZ1oxq7NxVyGo8M3KI5jbkiwNAdZFFzAdC68up4= | ||||
| github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= | ||||
| @@ -45,8 +43,6 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA | ||||
| github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | ||||
| github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= | ||||
| github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | ||||
| github.com/kyoh86/xdg v1.2.0 h1:CERuT/ShdTDj+A2UaX3hQ3mOV369+Sj+wyn2nIRIIkI= | ||||
| github.com/kyoh86/xdg v1.2.0/go.mod h1:/mg8zwu1+qe76oTFUBnyS7rJzk7LLC0VGEzJyJ19DHs= | ||||
| github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= | ||||
| github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= | ||||
| github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= | ||||
| @@ -104,8 +100,6 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w | ||||
| golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20201013132646-2da7054afaeb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20201118182958-a01c418693c7 h1:Z991aAXPjz0tLnj74pVXW3eWJ5lHMIBvbRfMq4M2jHA= | ||||
| golang.org/x/sys v0.0.0-20201118182958-a01c418693c7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= | ||||
| golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= | ||||
|   | ||||
							
								
								
									
										28
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								main.go
									
									
									
									
									
								
							| @@ -22,7 +22,7 @@ type waMsg struct { | ||||
| 	Text string | ||||
| } | ||||
|  | ||||
| var VERSION string = "v0.7.0" | ||||
| var VERSION string = "v0.7.4" | ||||
|  | ||||
| var sendChannel chan waMsg | ||||
| var textChannel chan whatsapp.TextMessage | ||||
| @@ -58,6 +58,7 @@ func main() { | ||||
| 	gridLayout.SetColumns(sideBarWidth, 0, sideBarWidth) | ||||
| 	gridLayout.SetBorders(true) | ||||
| 	gridLayout.SetBackgroundColor(config.GetColor("background")) | ||||
| 	gridLayout.SetBordersColor(config.GetColor("borders")) | ||||
|  | ||||
| 	topBar = tview.NewTextView() | ||||
| 	topBar.SetDynamicColors(true) | ||||
| @@ -85,7 +86,8 @@ func main() { | ||||
|  | ||||
| 	textInput = tview.NewInputField() | ||||
| 	textInput.SetBackgroundColor(config.GetColor("background")) | ||||
| 	textView.SetTextColor(config.GetColor("text")) | ||||
| 	textInput.SetFieldBackgroundColor(config.GetColor("input_background")) | ||||
| 	textInput.SetFieldTextColor(config.GetColor("input_text")) | ||||
| 	textInput.SetChangedFunc(func(change string) { | ||||
| 		sndTxt = change | ||||
| 	}) | ||||
| @@ -162,24 +164,6 @@ func MakeTree() *tview.TreeView { | ||||
| 			node.SetExpanded(!node.IsExpanded()) | ||||
| 		} | ||||
| 	}) | ||||
| 	treeView.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | ||||
| 		if event.Key() == tcell.KeyTab { | ||||
| 			app.SetFocus(textInput) | ||||
| 			return nil | ||||
| 		} | ||||
| 		if event.Key() == tcell.KeyCtrlSpace { | ||||
| 			app.SetFocus(textInput) | ||||
| 			return nil | ||||
| 		} | ||||
| 		if event.Key() == tcell.KeyCtrlW { | ||||
| 			app.SetFocus(textView) | ||||
| 			if curRegions != nil && len(curRegions) > 0 { | ||||
| 				textView.Highlight(curRegions[len(curRegions)-1]) | ||||
| 			} | ||||
| 			return nil | ||||
| 		} | ||||
| 		return event | ||||
| 	}) | ||||
| 	return treeView | ||||
| } | ||||
|  | ||||
| @@ -226,6 +210,7 @@ func handleConnect(ev *tcell.EventKey) *tcell.EventKey { | ||||
| } | ||||
|  | ||||
| func handleQuit(ev *tcell.EventKey) *tcell.EventKey { | ||||
| 	messages.Disconnect() | ||||
| 	app.Stop() | ||||
| 	return nil | ||||
| } | ||||
| @@ -394,7 +379,7 @@ func PrintHelp() { | ||||
| 	fmt.Fprintln(textView, "[::b]", config.GetKey("focus_contacts"), "[::-] = focus contacts panel") | ||||
| 	fmt.Fprintln(textView, "[::b]", config.GetKey("focus_input"), "[::-] = focus input") | ||||
| 	fmt.Fprintln(textView, "") | ||||
| 	fmt.Fprintln(textView, "[-::-]Chat window focused:[-::-]") | ||||
| 	fmt.Fprintln(textView, "[-::-]Message panel focused:[-::-]") | ||||
| 	fmt.Fprintln(textView, "[::b] Up/Down[::-] = select message") | ||||
| 	fmt.Fprintln(textView, "[::b]", config.GetKey("message_download"), "[::-] = download attachment -> ", config.GetSetting("download_path")) | ||||
| 	fmt.Fprintln(textView, "[::b]", config.GetKey("message_open"), "[::-] = download & open attachment -> ", config.GetSetting("preview_path")) | ||||
| @@ -452,6 +437,7 @@ func EnterCommand(key tcell.Key) { | ||||
| 	} | ||||
| 	if sndTxt == "/quit" { | ||||
| 		//command | ||||
| 		messages.Disconnect() | ||||
| 		app.Stop() | ||||
| 		return | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user