Struct mailpot::models::ListSubscription
source · pub struct ListSubscription {
pub pk: i64,
pub list: i64,
pub address: String,
pub name: Option<String>,
pub account: Option<i64>,
pub enabled: bool,
pub verified: bool,
pub digest: bool,
pub hide_address: bool,
pub receive_duplicates: bool,
pub receive_own_posts: bool,
pub receive_confirmation: bool,
}
Expand description
A mailing list subscription entry.
Fields§
§pk: i64
Database primary key.
list: i64
Mailing list foreign key (See MailingList
).
address: String
Subscription’s e-mail address.
name: Option<String>
Subscription’s name, optional.
account: Option<i64>
Subscription’s account foreign key, optional.
enabled: bool
Whether this subscription is enabled.
verified: bool
Whether the e-mail address is verified.
digest: bool
Whether subscription wishes to receive list posts as a periodical digest e-mail.
hide_address: bool
Whether subscription wishes their e-mail address hidden from public view.
receive_duplicates: bool
Whether subscription wishes to receive mailing list post duplicates, i.e. posts addressed to them and the mailing list to which they are subscribed.
receive_own_posts: bool
Whether subscription wishes to receive their own mailing list posts from the mailing list, as a confirmation.
receive_confirmation: bool
Whether subscription wishes to receive a plain confirmation for their own mailing list posts.
Implementations§
source§impl ListSubscription
impl ListSubscription
sourcepub fn address(&self) -> Address
pub fn address(&self) -> Address
Subscription address as a [melib::Address
]
Examples found in repository?
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
fmt,
"{} [digest: {}, hide_address: {} verified: {} {}]",
self.address(),
self.digest,
self.hide_address,
self.verified,
if self.enabled {
"enabled"
} else {
"not enabled"
},
)
}
More examples
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
fn feed<'p, 'list>(
self: Box<Self>,
post: &'p mut PostEntry,
ctx: &'p mut ListContext<'list>,
) -> std::result::Result<(&'p mut PostEntry, &'p mut ListContext<'list>), ()> {
trace!("Running FinalizeRecipients filter");
let mut recipients = vec![];
let mut digests = vec![];
let email_from = post.from.get_email();
for subscription in ctx.subscriptions {
trace!("examining subscription {:?}", &subscription);
if subscription.address == email_from {
trace!("subscription is submitter");
}
if subscription.digest {
if subscription.address != email_from || subscription.receive_own_posts {
trace!("Subscription gets digest");
digests.push(subscription.address());
}
continue;
}
if subscription.address != email_from || subscription.receive_own_posts {
trace!("Subscription gets copy");
recipients.push(subscription.address());
}
}
ctx.scheduled_jobs.push(MailJob::Send { recipients });
if !digests.is_empty() {
ctx.scheduled_jobs.push(MailJob::StoreDigest {
recipients: digests,
});
}
post.action = PostAction::Accept;
Ok((post, ctx))
}
Trait Implementations§
source§impl Clone for ListSubscription
impl Clone for ListSubscription
source§fn clone(&self) -> ListSubscription
fn clone(&self) -> ListSubscription
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ListSubscription
impl Debug for ListSubscription
source§impl<'de> Deserialize<'de> for ListSubscription
impl<'de> Deserialize<'de> for ListSubscription
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Display for ListSubscription
impl Display for ListSubscription
source§impl From<ListOwner> for ListSubscription
impl From<ListOwner> for ListSubscription
source§impl PartialEq<ListSubscription> for ListSubscription
impl PartialEq<ListSubscription> for ListSubscription
source§fn eq(&self, other: &ListSubscription) -> bool
fn eq(&self, other: &ListSubscription) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ListSubscription
impl Serialize for ListSubscription
impl Eq for ListSubscription
impl StructuralEq for ListSubscription
impl StructuralPartialEq for ListSubscription
Auto Trait Implementations§
impl RefUnwindSafe for ListSubscription
impl Send for ListSubscription
impl Sync for ListSubscription
impl Unpin for ListSubscription
impl UnwindSafe for ListSubscription
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.