Changeset 563ece2
- Timestamp:
- 08/22/10 21:29:27 (3 years ago)
- Branches:
- master
- Children:
- 67c3cdb
- Parents:
- 5d836bd
- git-author:
- Antti-Juhani Kaijanaho <antti-juhani@…> (08/22/10 21:29:27)
- git-committer:
- Antti-Juhani Kaijanaho <antti-juhani@…> (08/22/10 21:29:27)
- Files:
-
- 1 added
- 7 edited
-
db/FORMAT.txt (modified) (1 diff)
-
db/db.cc (modified) (1 diff)
-
db/user.cc (modified) (2 diffs)
-
db/user.hh (modified) (2 diffs)
-
http/article.cc (modified) (2 diffs)
-
http/markread.cc (added)
-
nntp/article.cc (modified) (2 diffs)
-
tlate/msg_value.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
db/FORMAT.txt
re1af652 r563ece2 45 45 - delivery_email_cookie (string) 46 46 - allow_cleartext_password ("yes" / "no") 47 - has_read (string: msgid) 48 - has_not_read (string: msgid) 47 49 48 50 If the userid doesn't yet exist, it is created with the given -
db/db.cc
r5d836bd r563ece2 165 165 else if (key == "allow_cleartext_password") 166 166 u->do_allow_cleartext_password = line == "yes"; 167 else if (key == "has_read") 168 u->read_msgids.insert(line); 169 else if (key == "has_not_read") 170 u->read_msgids.erase(line); 167 171 else if (key == "allow_posting") 168 172 { -
db/user.cc
r5d836bd r563ece2 190 190 << "USER ADD " + userid; 191 191 dbase->add_record(os.str()); 192 roles.insert(r);193 r->users.insert(shared_from_this());192 BOOST_ASSERT(roles.find(r) != roles.end()); 193 BOOST_ASSERT(r->users.find(shared_from_this())!=r->users.end()); 194 194 } 195 195 … … 203 203 << "USER DEL " + userid; 204 204 dbase->add_record(os.str()); 205 roles.erase(r); 206 r->users.erase(shared_from_this()); 205 BOOST_ASSERT(roles.find(r) == roles.end()); 206 BOOST_ASSERT(r->users.find(shared_from_this())==r->users.end()); 207 } 208 209 void user::mark_read(std::string msgid) 210 { 211 if (has_read(msgid)) return; 212 std::ostringstream os; 213 os << "USER " << userid << "\r\n" 214 << "has_read " << msgid; 215 dbase->add_record(os.str()); 216 BOOST_ASSERT(has_read(msgid)); 217 } 218 void user::unmark_read(std::string msgid) 219 { 220 if (!has_read(msgid)) return; 221 std::ostringstream os; 222 os << "USER " << userid << "\r\n" 223 << "has_not_read " << msgid; 224 dbase->add_record(os.str()); 225 BOOST_ASSERT(!has_read(msgid)); 207 226 } 208 227 -
db/user.hh
r5d836bd r563ece2 51 51 std::set< boost::shared_ptr<role> > roles; 52 52 53 std::set<std::string> read_msgids; 54 53 55 friend class db; 54 56 public: … … 100 102 void delete_role(boost::shared_ptr<role> r); 101 103 104 bool has_read(std::string msgid) const { 105 return read_msgids.find(msgid) != read_msgids.end(); 106 } 107 void mark_read(std::string msgid); 108 void unmark_read(std::string msgid); 109 102 110 static std::string passwd_problems(std::string pw) { 103 111 std::string err; -
http/article.cc
rcc0a570 r563ece2 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 94 94 95 95 boost::shared_ptr<db::user> u = req->get_user(); 96 97 if (is_single && u) u->mark_read(art->msgid()); 96 98 97 99 db::thread_node::ptr tn = -
nntp/article.cc
re060cc1 r563ece2 22 22 23 23 #include "../db/db.hh" 24 #include "../db/user.hh" 24 25 #include "../msg/msg.hh" 25 26 … … 138 139 139 140 std::string msgparm = msgnum + " " + message->msgid(); 141 142 if (c.identity() && (cmd == ARTICLE || cmd == BODY)) 143 c.identity()->mark_read(message->msgid()); 140 144 141 145 switch (cmd) { -
tlate/msg_value.cc
r4c1c17d r563ece2 278 278 rv.reset(new sv(boost::lexical_cast<std::string> 279 279 (tn->cardinality()))); 280 else if (u && var == "marked_read" && u->has_read(msgid)) 281 rv.reset(new empty_value); 280 282 return rv; 281 283 }
Note: See TracChangeset
for help on using the changeset viewer.
