added feature to remove records

develop
tastytea 2018-08-30 16:40:06 +02:00
parent 2bd6eeae40
commit a2d9c2eb5c
No known key found for this signature in database
GPG Key ID: CFC39497F1B26E07
3 changed files with 34 additions and 14 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7) cmake_minimum_required (VERSION 3.7)
project (whyblocked project (whyblocked
VERSION 0.3.0 VERSION 0.4.0
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -5,20 +5,30 @@ It has a text interface and uses a SQLite-database.
## Usage ## Usage
### Example
```PLAIN ```PLAIN
$ whyblocked $ whyblocked
This is whyblock 0.1.0. This is whyblock 0.4.0.
Type add, remove, view or details. Or just the first letter. Type add, remove, view or details. Or just the first letter.
: v Type quit or q to quit the program.
Blocked: @baduser@social.example.com because: Is very mean : add
Silenced: @truebelievers.example.com because: Annoying instance User or instance: @tastytea@soc.ialis.me
: d Blocked(b) or silenced(s): b
Which user? Reason: Too nice
@baduser@social.example.com Add receipt? [y/n] y
@baduser@social.example.com is blocked, because: Is very mean URL: https://tastytea.de/
Add receipt? [y/n] n
: view
Blocked: @tastytea@soc.ialis.me because: Too nice
: details
User or instance: @tastytea@soc.ialis.me
@tastytea@soc.ialis.me is blocked, because: Too nice
Receipts: Receipts:
https:///social.example.com/@baduser/123456789012345678 https://tastytea.de/
: q : remove
User or instance: @tastytea@soc.ialis.me
: quit
``` ```
## Install ## Install

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
{ {
string user, reason; string user, reason;
int blocked = -1; int blocked = -1;
cout << "User or Instance: "; cout << "User or instance: ";
cin >> user; cin >> user;
while (blocked == -1) while (blocked == -1)
{ {
@ -113,7 +113,17 @@ int main(int argc, char *argv[])
case 'r': case 'r':
case 'R': case 'R':
{ {
cout << "REMOVE\n"; string user;
cout << "User or instance: ";
cin >> user;
sqlite::execute rm_blocks(con, "DELETE FROM blocks WHERE user = ?;");
sqlite::execute rm_urls(con, "DELETE FROM urls WHERE user = ?;");
rm_blocks % user;
rm_urls % user;
rm_blocks();
rm_urls();
break; break;
} }
case 'v': case 'v':
@ -139,7 +149,7 @@ int main(int argc, char *argv[])
case 'd': case 'd':
case 'D': case 'D':
{ {
cout << "Which user?\n"; cout << "User or instance: ";
cin >> answer; cin >> answer;
{ {
sqlite::query q(con, "SELECT * FROM blocks WHERE user = \'" + answer + "\';"); sqlite::query q(con, "SELECT * FROM blocks WHERE user = \'" + answer + "\';");