Skip to content

Commit

Permalink
code style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JojiiOfficial committed Feb 21, 2021
1 parent 5f80e8c commit cafb530
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions main/Database.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ type dbChange struct {
}

var tables = []table{
table{"mail", "mail TEXT, room INTEGER"},
table{"rooms", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, roomID TEXT, imapAccount INTEGER DEFAULT -1, smtpAccount INTEGER DEFAULT -1, mailCheckInterval INTEGER, isHTMLenabled INTEGER"},
table{"imapAccounts", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, host TEXT, username TEXT, password TEXT, ignoreSSL INTEGER, mailbox TEXT"},
table{"smtpAccounts", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, host TEXT, port int, username TEXT, password TEXT, ignoreSSL INTEGER"},
table{"emailWritingTemp", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, roomID TEXT, receiver TEXT, subject TEXT DEFAULT ' ', body TEXT DEFAULT ' ', markdown INTEGER"},
table{"version", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, version INTEGER"},
table{"emailAttachments", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, writeTempID INTEGER, fileName TEXT"},
{"mail", "mail TEXT, room INTEGER"},
{"rooms", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, roomID TEXT, imapAccount INTEGER DEFAULT -1, smtpAccount INTEGER DEFAULT -1, mailCheckInterval INTEGER, isHTMLenabled INTEGER"},
{"imapAccounts", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, host TEXT, username TEXT, password TEXT, ignoreSSL INTEGER, mailbox TEXT"},
{"smtpAccounts", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, host TEXT, port int, username TEXT, password TEXT, ignoreSSL INTEGER"},
{"emailWritingTemp", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, roomID TEXT, receiver TEXT, subject TEXT DEFAULT ' ', body TEXT DEFAULT ' ', markdown INTEGER"},
{"version", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, version INTEGER"},
{"emailAttachments", "pk_id INTEGER PRIMARY KEY AUTOINCREMENT, writeTempID INTEGER, fileName TEXT"},
}

func handleDBVersion() {
Expand Down Expand Up @@ -101,9 +101,9 @@ func saveVersion(version int) error {
}

var dbChanges = []dbChange{
dbChange{2, "ALTER TABLE rooms ADD isHTMLenabled INTEGER"},
dbChange{2, "UPDATE rooms SET isHTMLenabled=0"},
dbChange{7, "CREATE TABLE `blocklist` (`pkID` INTEGER PRIMARY KEY AUTOINCREMENT, `imapAccount` INTEGER, `address` INTEGER);"},
{2, "ALTER TABLE rooms ADD isHTMLenabled INTEGER"},
{2, "UPDATE rooms SET isHTMLenabled=0"},
{7, "CREATE TABLE `blocklist` (`pkID` INTEGER PRIMARY KEY AUTOINCREMENT, `imapAccount` INTEGER, `address` INTEGER);"},
}

func startDBupgrader(oldVers int) {
Expand Down
4 changes: 2 additions & 2 deletions main/Main.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func startMatrixSync(client *mautrix.Client) {
return
}
} else if evt.Content.AsMessage().MsgType == event.MsgFile || evt.Content.AsMessage().MsgType == event.MsgImage {
if strings.HasPrefix(string(evt.Content.AsMessage().URL) , "mxc://") {
if strings.HasPrefix(string(evt.Content.AsMessage().URL), "mxc://") {
reader, err := client.Download(id.MustParseContentURI(evt.Content.AsMessage().Body))
if err != nil {
client.SendText(roomID, "Couldn't download File: "+err.Error())
Expand Down Expand Up @@ -1048,7 +1048,7 @@ func handleMail(mail *imap.Message, section *imap.BodySectionName, account imapA
}
from := html.EscapeString(content.from)
fmt.Println("attachments: " + content.attachment)
headerContent := &event.MessageEventContent {
headerContent := &event.MessageEventContent{
Format: event.FormatHTML,
Body: "\r\n────────────────────────────────────\r\n## You've got a new Email from " + from + "\r\n" + "Subject: " + content.subject + "\r\n" + "────────────────────────────────────",
FormattedBody: "<br>────────────────────────────────────<br><b> You've got a new Email</b> from <b>" + from + "</b><br>" + "Subject: " + content.subject + "<br>" + "────────────────────────────────────",
Expand Down

0 comments on commit cafb530

Please sign in to comment.