Compare commits
2 Commits
ac4b0ef47b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c6d1a8d455 | |||
| c8745e1f60 |
@@ -7,10 +7,10 @@ stb:
|
|||||||
#mailboxes: ["Done"]
|
#mailboxes: ["Done"]
|
||||||
search-criteria: ["Your Share The Brutality digest", "noreply@sharethebrutality.info"]
|
search-criteria: ["Your Share The Brutality digest", "noreply@sharethebrutality.info"]
|
||||||
move-processed-to-mailbox:
|
move-processed-to-mailbox:
|
||||||
succeed: Processed/Succeed
|
succeed: Succeed
|
||||||
#succeed: Done
|
#succeed: Done
|
||||||
failed: Processed/Failed
|
failed: Failed
|
||||||
suspicious: Processed/Suspicious
|
suspicious: Suspicious
|
||||||
sender:
|
sender:
|
||||||
mailbox: noreply
|
mailbox: noreply
|
||||||
host: sharethebrutality.info
|
host: sharethebrutality.info
|
||||||
|
|||||||
2
install.sh
Normal file
2
install.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
env GOBIN=/usr/local/bin go install ./cmd
|
||||||
@@ -181,7 +181,9 @@ func (s *EmailService) MoveMessageToMailbox(msg *client.FetchMessageBuffer, stat
|
|||||||
movable.AddNum(msg.SeqNum)
|
movable.AddNum(msg.SeqNum)
|
||||||
mailbox := viper.GetStringMapString("stb.move-processed-to-mailbox")
|
mailbox := viper.GetStringMapString("stb.move-processed-to-mailbox")
|
||||||
wait, err := s.client.Move(movable, mailbox[status]).Wait()
|
wait, err := s.client.Move(movable, mailbox[status]).Wait()
|
||||||
|
|
||||||
if s.CheckErr("Moving to archive", err) {
|
if s.CheckErr("Moving to archive", err) {
|
||||||
|
fmt.Println("Error moving to mail:", mailbox[status], "Error:", err.Error())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,13 +47,10 @@ func (s *ShareTheBrutality) GetMail(email string) ([]model.ExternalSources, *mai
|
|||||||
//now := carbon.Now()
|
//now := carbon.Now()
|
||||||
s.EmailService.ListMessages(viper.GetStringSlice(mailboxes), searchCriteria)
|
s.EmailService.ListMessages(viper.GetStringSlice(mailboxes), searchCriteria)
|
||||||
//box.CreateMailbox("INBOX/Processed")
|
//box.CreateMailbox("INBOX/Processed")
|
||||||
//s.EmailService.CreateMailbox("Processed")
|
|
||||||
//s.EmailService.CreateMailbox("Succeed")
|
//s.EmailService.CreateMailbox("Succeed")
|
||||||
//s.EmailService.CreateMailbox("Processed/Succeed")
|
//s.EmailService.DeleteMailbox("Succeed")
|
||||||
//s.EmailService.DeleteMailbox("Processed")
|
|
||||||
//s.EmailService.CreateMailbox("Processed/Failed")
|
s.EmailService.MailboxesList()
|
||||||
//s.EmailService.CreateMailbox("Processed/Suspicious")
|
|
||||||
//s.EmailService.MailboxesList()
|
|
||||||
|
|
||||||
entries := s.Processing(viper.GetStringMapString(fmt.Sprintf("%s.sender", s.scope)))
|
entries := s.Processing(viper.GetStringMapString(fmt.Sprintf("%s.sender", s.scope)))
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ func BatchInsertOnDuplicate(entries []model.ExternalSources, db *sqlx.DB, column
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *ExternalSources) GetTypeIds(entries []model.ExternalSources, db *sqlx.DB) []int {
|
func (f *ExternalSources) GetTypeIds(entries []model.ExternalSources, db *sqlx.DB) []int {
|
||||||
|
if len(entries) == 0 {
|
||||||
|
fmt.Printf("Entries are empty")
|
||||||
|
return nil // або логування помилки
|
||||||
|
}
|
||||||
|
|
||||||
var typeIds []int
|
var typeIds []int
|
||||||
ids := thither.FieldValueToStrSlice(entries, "TypeId")
|
ids := thither.FieldValueToStrSlice(entries, "TypeId")
|
||||||
query := fmt.Sprintf("SELECT type_id FROM %s WHERE `type` = '%s' AND type_id IN (%s) LIMIT %d", constant.ExternalSourcesTable, entries[0].Type, strings.Join(ids, ","), len(ids))
|
query := fmt.Sprintf("SELECT type_id FROM %s WHERE `type` = '%s' AND type_id IN (%s) LIMIT %d", constant.ExternalSourcesTable, entries[0].Type, strings.Join(ids, ","), len(ids))
|
||||||
|
|||||||
Reference in New Issue
Block a user