Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
myOwnPad
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
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dario
myOwnPad
Commits
cef5d289
Commit
cef5d289
authored
9 years ago
by
dario
Browse files
Options
Downloads
Patches
Plain Diff
implement some more NetProtoShow instances
parent
1f9a9b34
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Pad/NetProtocol/Instances.hs
+17
-4
17 additions, 4 deletions
src/Pad/NetProtocol/Instances.hs
src/Pad/NetProtocol/Types.hs
+6
-3
6 additions, 3 deletions
src/Pad/NetProtocol/Types.hs
with
23 additions
and
7 deletions
src/Pad/NetProtocol/Instances.hs
+
17
−
4
View file @
cef5d289
...
...
@@ -70,23 +70,36 @@ instance NetSendable TextAttribute where
netProtoShow
(
AttrFontBold
)
=
fromByteString
"B"
netProtoShow
(
AttrFontItalic
)
=
fromByteString
"I"
-- TODO: think about escaping..
instance
NetSendable
UserName
where
netProtoShow
::
UserName
->
Builder
netProtoShow
=
fromByteString
.
fromUserName
-- TODO: hier nur authorId schreiben, client am anfang (in http) ne
-- liste von authorIds geben und neue ggf. broadcasten?
instance
NetSendable
ChatMessage
where
netProtoShow
::
ChatMessage
->
Builder
netProtoShow
=
undefined
-- TODO
instance
NetSendable
PadMetaEvent
where
netProtoShow
::
PadMetaEvent
->
Builder
netProtoShow
=
undefined
-- TODO
netProtoShow
MetaClientEnter
=
fromByteString
"E:"
{- <> TODO -}
netProtoShow
MetaClientLeave
=
fromByteString
"L:"
{- <> TODO -}
netProtoShow
(
MetaNickChange
aid
nick
)
=
fromByteString
"N:"
<>
netProtoShow
aid
<>
netProtoShow
nick
netProtoShow
MetaPadSettingsChange
=
fromByteString
"S:"
{- <> TODO -}
netProtoShow
(
MetaAllUsersNotification
n
)
=
fromByteString
"B:"
<>
fromByteString
n
netProtoShow
MetaPadCreationFinished
=
fromByteString
"F"
instance
NetSendable
ClientMessage
where
netProtoShow
::
ClientMessage
->
Builder
netProtoShow
(
CM_TextChange
ch
)
=
fromByteString
"E
:
"
fromByteString
"E"
<>
netProtoShow
ch
netProtoShow
(
CM_ChatEvent
cm
)
=
fromByteString
"C
:
"
fromByteString
"C"
<>
netProtoShow
cm
netProtoShow
(
CM_PadMetaEvent
pme
)
=
fromByteString
"M
:
"
fromByteString
"M"
<>
netProtoShow
pme
This diff is collapsed.
Click to expand it.
src/Pad/NetProtocol/Types.hs
+
6
−
3
View file @
cef5d289
...
...
@@ -26,7 +26,7 @@ data Pos = Pos { line :: Word64, ch :: Word64 } deriving (Show, Eq)
newtype
Len
=
Len
{
fromLen
::
Word64
}
deriving
(
Show
,
Eq
)
newtype
RemoteAddr
=
RemoteAddr
BS
.
ByteString
deriving
(
Show
,
Eq
)
newtype
UserName
=
UserName
BS
.
ByteString
deriving
(
Show
,
Eq
)
newtype
UserName
=
UserName
{
fromUserName
::
BS
.
ByteString
}
deriving
(
Show
,
Eq
)
-- TODO
...
...
@@ -78,9 +78,12 @@ instance Eq ZonedTime where
data
PadMetaEvent
=
MetaClientEnter
{- TODO -}
|
MetaClientLeave
{- TODO -}
|
MetaNickChange
{- TODO -}
|
MetaNickChange
AuthorId
UserName
|
MetaPadSettingsChange
{- TODO -}
|
MetaAllUsersNotification
{- TODO -}
|
MetaAllUsersNotification
BS
.
ByteString
-- the client is supposed to reload upon receiving
-- this notification
|
MetaPadCreationFinished
deriving
(
Show
,
Eq
)
-- this is the grand overarching type for everything that can be sent to
...
...
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