func DhtReceiveXover(dhtPayload string) { var user_home = to.GetHomeDir() var messages_folder string = "/News/messages/" messages_folder = filepath.Join(user_home, messages_folder) var MyHeaders map[string]string MyHeaders = make(map[string]string) MyHeaders = dht.GpgGetHeaders(dhtPayload) messageId := MyHeaders[TRIBES_H_MID] groupname := MyHeaders[TRIBES_H_GID] dhtContent := dht.GpgDecrypt(dhtPayload) num_message, _ := strconv.Atoi(CreateSerialByGroup(groupname)) num_message++ msgnum_str := fmt.Sprintf("%05d", num_message) body_file := filepath.Join(messages_folder, "x-"+groupname+"-"+msgnum_str+"-"+messageId) if to.TheFileExists(body_file) == false { ShootStringToFile(dhtContent, body_file) } else { log.Printf("[DHT-3BE] we have %s already: doing nothing on xover", messageId) } }
func DhtReceiveBody(dhtPayload string) { var MyHeaders map[string]string MyHeaders = make(map[string]string) MyHeaders = dht.GpgGetHeaders(dhtPayload) messageId := MyHeaders[TRIBES_H_MID] groupname := MyHeaders[TRIBES_H_GID] dhtContent := dht.GpgDecrypt(dhtPayload) num_message, _ := strconv.Atoi(CreateSerialByGroup(groupname)) num_message++ msgnum_str := fmt.Sprintf("%05d", num_message) body_file := filepath.Join(to.MessagesFolder, "b-"+groupname+"-"+msgnum_str+"-"+messageId) if to.TheFileExists(body_file) == false { ShootStringToFile(dhtContent, body_file) } else { log.Printf("[DHT-3BE] we have %s already: doing nothing on body", messageId) } }