Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bulletin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Personal Projects
bulletin
Commits
74bfcc46
Unverified
Commit
74bfcc46
authored
1 month ago
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Lunch hacking
Incomplete - but updated notes and started implementing CHANGE.
parent
2ecfd7b0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
NOTES.md
+11
-2
11 additions, 2 deletions
NOTES.md
repl/messages.go
+96
-2
96 additions, 2 deletions
repl/messages.go
with
107 additions
and
4 deletions
NOTES.md
+
11
−
2
View file @
74bfcc46
...
...
@@ -21,7 +21,7 @@ Switch between MAIL and BULLETIN modes? MAIL commands are documented
## Things to do
*
Run
[
godoc
](
http://localhost:6060/
)
and then review where the help text is lacking.
*
Missing [RESPOND] [MAIL] [SET PROMPT_EXPIRE] [SET NOREADNEW] [SET NOSHOWNEW] [SET
EXPIRE_LIMIT] [SET
NOPROMPT_EXPIRE] [SET READNEW] [SET SHOWNEW]
[SET DEFAULT_EXPIRE]
[SHOW NEW]
*
Missing [RESPOND] [MAIL] [SET PROMPT_EXPIRE] [SET NOREADNEW] [SET NOSHOWNEW] [SET NOPROMPT_EXPIRE] [SET READNEW] [SET SHOWNEW] [SHOW NEW]
*
Run this.Skew.Safe() before... each command? each write?
*
Handle broadcast messages - create a broadcast table and add an expiration column.
*
Database
...
...
@@ -31,8 +31,17 @@ Switch between MAIL and BULLETIN modes? MAIL commands are documented
*
Commands to connect to Mattermost or mastodon?
*
Make a spreadsheet for signups.
*
Pager:
*
Make
/
work for search.
*
Make
"/"
work for search.
*
Run
[
VACUUM
](
https://www.sqlite.org/lang_vacuum.html
)
on the expire run.
*
Notifications:
*
Figure out how SHOWNEW, NOTIFY, READNEW and BRIEF work.
*
Permissions:
*
Review permission requirements for each command.
*
Expire. This was created due to file storage limits.
*
Code cleanup:
*
Review sql queries and clean out the ones not used.
*
Review sql queries and find duplicates.
*
Use
[
dupl
](
https://github.com/mibk/dupl
)
to find things to generalise.
Polishing. Review each command and put a + next to each as it is
fully done.
...
...
This diff is collapsed.
Click to expand it.
repl/messages.go
+
96
−
2
View file @
74bfcc46
...
...
@@ -190,9 +190,103 @@ func ActionBack(_ *dclish.Command) error {
return
nil
}
// ActionChange handles the `CHANGE` command.
// ActionChange handles the `CHANGE` command. This replaces or modifies
// an existing message.
func
ActionChange
(
cmd
*
dclish
.
Command
)
error
{
fmt
.
Printf
(
"TODO: unimplemented...
\n
%s
\n
"
,
cmd
.
Description
)
var
err
error
optAll
:=
false
if
cmd
.
Flags
[
"/ALL"
]
.
Value
==
"true"
{
optAll
=
true
}
optExpiration
:=
&
time
.
Time
{}
if
cmd
.
Flags
[
"/EXPIRATION"
]
.
Value
!=
""
{
// dd-mmm-yyyy, or delta time: dddd
exp
,
err
:=
time
.
Parse
(
"2006-01-02"
,
cmd
.
Flags
[
"/EXPIRATION"
]
.
Value
)
if
err
!=
nil
{
days
,
err
:=
strconv
.
Atoi
(
cmd
.
Flags
[
"/EXPIRATION"
]
.
Value
)
if
err
!=
nil
{
optExpiration
=
nil
}
exp
:=
time
.
Now
()
.
AddDate
(
0
,
0
,
days
)
optExpiration
=
&
exp
}
else
{
optExpiration
=
&
exp
}
}
optGeneral
:=
false
if
cmd
.
Flags
[
"/GENERAL"
]
.
Set
&&
this
.
Folder
.
Name
!=
"GENERAL"
{
return
errors
.
New
(
"Can only be used in the GENERAL folder"
)
}
if
cmd
.
Flags
[
"/GENERAL"
]
.
Value
==
"true"
{
optGeneral
=
true
}
if
cmd
.
Flags
[
"/GENERAL"
]
.
Set
&&
!
optGeneral
{
return
errors
.
New
(
"Can't specify /NOGENERAL - see /SYSTEM"
)
}
optNew
:=
false
if
cmd
.
Flags
[
"/NEW"
]
.
Value
==
"true"
{
optNew
=
true
}
optNumber
:=
[]
int64
{
this
.
MsgID
}
if
cmd
.
Flags
[
"/NUMBER"
]
.
Set
&&
cmd
.
Flags
[
"/NUMBER"
]
.
Value
==
""
{
return
errors
.
New
(
"Must supply message number(s) if /NUMBER is set"
)
}
if
cmd
.
Flags
[
"/NUMBER"
]
.
Value
!=
""
{
optNumber
,
err
=
ParseNumberList
(
cmd
.
Flags
[
"/NUMBER"
]
.
Value
)
if
err
!=
nil
{
return
err
}
}
optPermanent
:=
false
if
cmd
.
Flags
[
"/PERMANENT"
]
.
Value
==
"true"
{
optPermanent
=
true
}
optShutdown
:=
false
if
cmd
.
Flags
[
"/SHUTDOWN"
]
.
Value
==
"true"
{
optShutdown
=
true
}
optSubject
:=
""
if
cmd
.
Flags
[
"/SUBJECT"
]
.
Set
&&
cmd
.
Flags
[
"/SUBJECT"
]
.
Value
==
""
{
return
errors
.
New
(
"Must supply subject text if /SUBJECT is set"
)
}
if
cmd
.
Flags
[
"/SUBJECT"
]
.
Value
!=
""
{
optSubject
=
cmd
.
Flags
[
"/SUBJECT"
]
.
Value
}
optSystem
:=
false
if
cmd
.
Flags
[
"/SYSTEM"
]
.
Set
{
if
this
.
User
.
Admin
==
0
{
return
errors
.
New
(
"Must be admin"
)
}
if
this
.
Folder
.
Name
!=
"GENERAL"
{
return
errors
.
New
(
"Can only be used in the GENERAL folder"
)
}
}
if
cmd
.
Flags
[
"/SYSTEM"
]
.
Value
==
"true"
{
optSystem
=
true
}
if
cmd
.
Flags
[
"/SYSTEM"
]
.
Set
&&
!
optSystem
{
return
errors
.
New
(
"Can't specify /NOSYSTEM - see /GENERAL"
)
}
optText
:=
false
if
cmd
.
Flags
[
"/TEXT"
]
.
Value
==
"true"
{
optText
=
true
}
// Sanity checking.
if
optSystem
&&
optGeneral
{
return
errors
.
New
(
"Can't specify /SYSTEM and /GENERAL"
)
}
fmt
.
Println
(
"TODO: flags parsed, now need to do something."
)
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment