Reformatted code
This commit is contained in:
22
gomilter.go
22
gomilter.go
@@ -24,14 +24,14 @@ package gomilter
|
|||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"unsafe"
|
|
||||||
"encoding/binary"
|
|
||||||
"reflect"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sockaddr_in struct {
|
type sockaddr_in struct {
|
||||||
@@ -193,7 +193,6 @@ func GobDecode(buf []byte, data interface{}) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ********* Filter Callback functions *********
|
// ********* Filter Callback functions *********
|
||||||
// These are registered with Milter
|
// These are registered with Milter
|
||||||
// They are only called if they get registered but need to be defined anyway
|
// They are only called if they get registered but need to be defined anyway
|
||||||
@@ -491,7 +490,7 @@ func AddHeader(ctx uintptr, headerf, headerv string) int {
|
|||||||
defer C.free(unsafe.Pointer(cheaderv))
|
defer C.free(unsafe.Pointer(cheaderv))
|
||||||
|
|
||||||
// Call smfi_addheader
|
// Call smfi_addheader
|
||||||
return int(C.smfi_addheader(int2ctx(ctx), cheaderf, cheaderv));
|
return int(C.smfi_addheader(int2ctx(ctx), cheaderf, cheaderv))
|
||||||
}
|
}
|
||||||
|
|
||||||
func ChgHeader(ctx uintptr, headerf string, hdridx int, headerv string) int {
|
func ChgHeader(ctx uintptr, headerf string, hdridx int, headerv string) int {
|
||||||
@@ -504,7 +503,7 @@ func ChgHeader(ctx uintptr, headerf string, hdridx int, headerv string) int {
|
|||||||
defer C.free(unsafe.Pointer(cheaderv))
|
defer C.free(unsafe.Pointer(cheaderv))
|
||||||
|
|
||||||
// Call smfi_chgheader
|
// Call smfi_chgheader
|
||||||
return int(C.smfi_chgheader(int2ctx(ctx), cheaderf, C.int(hdridx), cheaderv));
|
return int(C.smfi_chgheader(int2ctx(ctx), cheaderf, C.int(hdridx), cheaderv))
|
||||||
}
|
}
|
||||||
|
|
||||||
func InsHeader(ctx uintptr, hdridx int, headerf, headerv string) int {
|
func InsHeader(ctx uintptr, hdridx int, headerf, headerv string) int {
|
||||||
@@ -517,10 +516,9 @@ func InsHeader(ctx uintptr, hdridx int, headerf, headerv string) int {
|
|||||||
defer C.free(unsafe.Pointer(cheaderv))
|
defer C.free(unsafe.Pointer(cheaderv))
|
||||||
|
|
||||||
// Call smfi_insheader
|
// Call smfi_insheader
|
||||||
return int(C.smfi_insheader(int2ctx(ctx), C.int(hdridx), cheaderf, cheaderv));
|
return int(C.smfi_insheader(int2ctx(ctx), C.int(hdridx), cheaderf, cheaderv))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func ChgFrom(ctx uintptr, mail, args string) int {
|
func ChgFrom(ctx uintptr, mail, args string) int {
|
||||||
/* Change the envelope sender address. SMFIF_CHGFROM
|
/* Change the envelope sender address. SMFIF_CHGFROM
|
||||||
*/
|
*/
|
||||||
@@ -595,8 +593,6 @@ func progress(ctx uintptr) int {
|
|||||||
|
|
||||||
// ********* Run the milter *********
|
// ********* Run the milter *********
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func Run(amilter Milter) int {
|
func Run(amilter Milter) int {
|
||||||
milter = amilter
|
milter = amilter
|
||||||
if milter.GetDebug() {
|
if milter.GetDebug() {
|
||||||
|
|||||||
@@ -15,13 +15,10 @@ Sample Milter
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
||||||
"."
|
"."
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Mymilter struct {
|
type Mymilter struct {
|
||||||
gomilter.MilterRaw // Embed the basic functionality. No callbacks yet
|
gomilter.MilterRaw // Embed the basic functionality. No callbacks yet
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,8 @@ Copyright (c) 2015 Leon Baker
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
||||||
m "github.com/leonrbaker/gomilter"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
m "github.com/leonrbaker/gomilter"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Mymilter struct {
|
type Mymilter struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user