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)
project (whyblocked
VERSION 0.3.0
VERSION 0.4.0
LANGUAGES CXX
)

View File

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

View File

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