2021-04-11 15:25:34 +02:00
|
|
|
#include "mediafilter.h"
|
|
|
|
|
|
|
|
void HasMediaFilter::setup(std::ostream& o, std::istream& str) {
|
|
|
|
o << "Should the message have media?";
|
|
|
|
|
|
|
|
char c;
|
|
|
|
str >> c;
|
|
|
|
|
|
|
|
needMedia = isYes(c);
|
|
|
|
resetStream(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasMediaFilter::filter(const Message& m) const {
|
|
|
|
return m.hasFile() == needMedia;
|
2021-06-06 22:44:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void FilterChat::setup(std::ostream& o, std::istream& str) {
|
|
|
|
o << "Enter Chatid: ";
|
|
|
|
|
|
|
|
str >> chatid;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FilterChat::filter(const Message& m) const {
|
|
|
|
return m.chatid == chatid;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ForwardedFromChatFilter::setup(std::ostream& o, std::istream& str) {
|
|
|
|
o << "Enter ChatName: ";
|
|
|
|
|
|
|
|
std::getline(str, chatname);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ForwardedFromChatFilter::filter(const Message& m) const {
|
|
|
|
return m.fwdFrom == chatname;
|
2021-04-11 15:25:34 +02:00
|
|
|
}
|