|
|
|
@ -49,6 +49,7 @@ pub struct WhatsappManager {
@@ -49,6 +49,7 @@ pub struct WhatsappManager {
|
|
|
|
|
autocreate: Option<String>, |
|
|
|
|
autoupdate_nicks: bool, |
|
|
|
|
mark_read: bool, |
|
|
|
|
drop_non_group_messages_on_the_floor: bool, |
|
|
|
|
track_presence: bool, |
|
|
|
|
our_jid: Option<Jid>, |
|
|
|
|
prev_jid: Option<Jid>, |
|
|
|
@ -112,6 +113,7 @@ impl WhatsappManager {
@@ -112,6 +113,7 @@ impl WhatsappManager {
|
|
|
|
|
let autocreate = p.cfg.whatsapp.autocreate_prefix.clone(); |
|
|
|
|
let backlog_start = p.cfg.whatsapp.backlog_start.clone(); |
|
|
|
|
let mark_read = p.cfg.whatsapp.mark_read; |
|
|
|
|
let drop_non_group_messages_on_the_floor = p.cfg.whatsapp.drop_non_group_messages_on_the_floor; |
|
|
|
|
let autoupdate_nicks = p.cfg.whatsapp.autoupdate_nicks; |
|
|
|
|
let backoff_time_ms = p.cfg.whatsapp.backoff_time_ms.unwrap_or(10000); |
|
|
|
|
let track_presence = p.cfg.whatsapp.track_presence; |
|
|
|
@ -126,6 +128,10 @@ impl WhatsappManager {
@@ -126,6 +128,10 @@ impl WhatsappManager {
|
|
|
|
|
backoff_time_ms |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if drop_non_group_messages_on_the_floor { |
|
|
|
|
error!("I'm going to drop all non-group messages on the floor! Are you sure this is a good idea?!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Self { |
|
|
|
|
conn, |
|
|
|
|
contacts: HashMap::new(), |
|
|
|
@ -137,7 +143,8 @@ impl WhatsappManager {
@@ -137,7 +143,8 @@ impl WhatsappManager {
|
|
|
|
|
outbox: VecDeque::new(), |
|
|
|
|
backlog_start, |
|
|
|
|
rx, cf_tx, cb_tx, qr_path, store, msgproc, autocreate, |
|
|
|
|
mark_read, autoupdate_nicks, track_presence, ackp |
|
|
|
|
mark_read, autoupdate_nicks, track_presence, ackp, |
|
|
|
|
drop_non_group_messages_on_the_floor |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
fn handle_int_rx(&mut self, c: WhatsappCommand) -> Result<()> { |
|
|
|
@ -409,7 +416,12 @@ impl WhatsappManager {
@@ -409,7 +416,12 @@ impl WhatsappManager {
|
|
|
|
|
let (msgs, is_media) = self.msgproc.process_wa_incoming(inc)?; |
|
|
|
|
let num_msgs = msgs.len(); |
|
|
|
|
for msg in msgs { |
|
|
|
|
self.store_message(&msg.from, &msg.text, msg.group, msg.ts)?; |
|
|
|
|
if self.drop_non_group_messages_on_the_floor && msg.group.is_some() && !is_media { |
|
|
|
|
// *thud*
|
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
self.store_message(&msg.from, &msg.text, msg.group, msg.ts)?; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if is_media { |
|
|
|
|
/* none of the other fancy stuff below applies */ |
|
|
|
|