Example #1
0
func onFileControl(t *golibtox.Tox, friendnumber int32, sending bool, filenumber uint8, fileControl golibtox.FileControl, data []byte, length uint16) {
	// Finished receiving file
	if fileControl == golibtox.FILECONTROL_FINISHED {
		f := transfers[filenumber]
		f.Sync()
		f.Close()
		delete(transfers, filenumber)
		fmt.Println("Written file", filenumber)
		t.SendMessage(friendnumber, []byte("Thanks!"))
	}
}
Example #2
0
func onFriendMessage(t *golibtox.Tox, friendnumber int32, message []byte, length uint16) {
	fmt.Printf("New message from %d : %s\n", friendnumber, string(message))
	// Echo back
	t.SendMessage(friendnumber, message)
}