Changeset f2c6ab73bbeb02eb513a3952a380305eeeae60ff for db
- Timestamp:
- 01/27/11 21:22:20 (16 months ago)
- Children:
- aab07470af6dc81c6a52e8b8446582745216df17
- Parents:
- cbc895b6da7a6196ef0422747bd7dec2a40551d5
- git-committer:
- ajk <ajk@…> (01/27/11 21:22:20)
- Location:
- db
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
db/group.cc
r383796f rf2c6ab7 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010, 2011 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 167 167 mam->insert("group", 168 168 new tlate::group_value(shared_from_this(), u)); 169 if (u->is_delivery_email_verified())170 mam->insert("verified");171 169 172 170 boost::shared_ptr<tlate::tlate> tl = tlate::tlate::parse(tln); … … 181 179 182 180 void group::add_subscriber(boost::shared_ptr<user> u, 183 server::conn_cb cb) 181 server::conn_cb cb, 182 boost::asio::ip::address peer) 184 183 { 185 184 BOOST_ASSERT(u); 186 185 ensure_subscriber_role(); 187 186 u->add_role(subscriber_role); 188 send_submail(u, "sub.msg", cb); 187 if (!u->is_delivery_email_verified()) 188 u->send_delivery_email_cookie 189 (cb, peer.to_string()); 190 else 191 send_submail(u, "sub.msg", cb); 189 192 } 190 193 void group::delete_subscriber(boost::shared_ptr<user> u, … … 193 196 ensure_subscriber_role(); 194 197 u->delete_role(subscriber_role); 195 send_submail(u, "unsub.msg", cb); 198 if (u->is_delivery_email_verified()) 199 send_submail(u, "unsub.msg", cb); 196 200 } 197 201 bool group::is_subscriber(boost::shared_ptr<const user> u) -
db/group.hh
r383796f rf2c6ab7 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010, 2011 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 99 99 100 100 void add_subscriber(boost::shared_ptr<user> u, 101 server::conn_cb cb); 101 server::conn_cb cb, 102 boost::asio::ip::address peer); 102 103 void delete_subscriber(boost::shared_ptr<user> u, 103 104 server::conn_cb cb); -
db/role.hh
r2114058 rf2c6ab7 83 83 } 84 84 85 bool is_subscriber_role() const 86 { return is_subscriber_role(name); } 87 88 std::string whose_subscriber_role() const { 89 return name.substr(subscriber_prefix.length()); 90 } 91 85 92 static bool is_subscriber_role(std::string str) { 86 93 return str.substr(0, subscriber_prefix.length()) -
db/user.cc
r2114058 rf2c6ab7 27 27 #include "../tlate/data_model.hh" 28 28 #include "../tlate/tlate.hh" 29 #include "../tlate/user_value.hh" 29 30 #include "../uri.hh" 30 31 … … 152 153 mam->insert("to", 153 154 ::msg::make_phrase(ton) + " <" + to + ">"); 154 mam->insert("user id", userid);155 mam->insert("user", new tlate::user_value(shared_from_this())); 155 156 mam->insert("link", link.str()); 156 157 mam->insert("request_ip", request_ip); … … 166 167 cb.smtpc().send_mail(recv, mos.str()); 167 168 } 168 bool user::verify_delivery_email(std::string cookie )169 bool user::verify_delivery_email(std::string cookie, server::conn_cb cb) 169 170 { 170 171 if (delivery_email_verified) return true; … … 178 179 dbase->add_record(os.str()); 179 180 BOOST_ASSERT(delivery_email_verified); 181 182 tlate::data_model::ptr mam(new tlate::data_model); 183 184 std::string ton = display_name; 185 std::string to = delivery_email; 186 std::string from = 187 config["alue-name"].as<std::string>() + 188 " <" + 189 config["operator-email"].as<std::string>() + 190 ">"; 191 mam->insert("from", from); 192 mam->insert("to", 193 ::msg::make_phrase(ton) + " <" + to + ">"); 194 mam->insert("user", new tlate::user_value(shared_from_this())); 195 196 boost::shared_ptr<tlate::tlate> tl = 197 tlate::tlate::parse("confirmed.msg"); 198 std::ostringstream mos; 199 mos << tl->eval(mam); 200 201 std::list<std::string> recv; 202 recv.push_back(to); 203 204 cb.smtpc().send_mail(recv, mos.str()); 205 180 206 return true; 181 207 } -
db/user.hh
r2114058 rf2c6ab7 84 84 void send_delivery_email_cookie(server::conn_cb cb, 85 85 std::string request_ip); 86 bool verify_delivery_email(std::string cookie); 86 bool verify_delivery_email(std::string cookie, 87 server::conn_cb cb); 87 88 88 89 bool allow_cleartext_password() const { … … 122 123 return err; 123 124 } 125 126 boost::shared_ptr<db> get_db() const { return dbase; }; 124 127 }; 125 128 }
