35 lines
704 B
C++
35 lines
704 B
C++
#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;
|
|
}
|
|
|
|
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;
|
|
} |