Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
I3csstatus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Jiří Kalvoda
I3csstatus
Commits
54c5c4e3
Commit
54c5c4e3
authored
2 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Parser: CheckmailStatus
parent
207f8fcd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Parsers.cs
+69
-0
69 additions, 0 deletions
Parsers.cs
with
69 additions
and
0 deletions
Parsers.cs
+
69
−
0
View file @
54c5c4e3
...
@@ -129,6 +129,75 @@ class ParserOsddLast: Parser
...
@@ -129,6 +129,75 @@ class ParserOsddLast: Parser
}
}
}
}
[
ParserName
(
"checkmail_status"
)]
class
ParserCheckmailLog
:
Parser
{
StatusBar
bar
;
public
void
Init
(
StatusBar
_bar
,
Module
_module
,
ConfigSection
section
)
{
bar
=
_bar
;
}
public
IEnumerable
<
Element
>
Parse
(
string
data
)
{
try
{
long
msgTime
=
int
.
Parse
(
data
.
Split
()[
0
]);
long
countNewMails
=
int
.
Parse
(
data
.
Split
()[
1
]);
long
delay
=
DateTimeOffset
.
Now
.
ToUnixTimeSeconds
()
-
msgTime
;
long
t
=
Environment
.
TickCount64
;
bool
t_parity
=
t
/
1000
%
2
==
0
;
if
(
countNewMails
>
0
)
{
bar
.
Schedule
((
int
)(
1000
-
t
%
1000
+
10
));
}
if
(
delay
<
-
5
||
delay
>
90
)
{
if
(
countNewMails
>
0
)
return
new
Element
[]{
new
Element
(
$"NO CONNECTION
{
TimeShow
.
Show
(
delay
)}
[
{
countNewMails
}
]"
,
color
:
t_parity
?
Color
.
FromArgb
(
255
,
0
,
0
):
Color
.
FromArgb
(
0x33
,
0x33
,
255
))};
else
return
new
Element
[]{
new
Element
(
$"NO CONNECTION
{
TimeShow
.
Show
(
delay
)}
"
,
color
:
Color
.
Red
)};
}
else
{
if
(
countNewMails
>
0
)
return
new
Element
[]{
new
Element
(
$"[
{
countNewMails
}
NEW]"
,
color
:
t_parity
?
Color
.
FromArgb
(
255
,
0x70
,
0
):
Color
.
FromArgb
(
0x33
,
0x33
,
255
))};
else
return
new
Element
[]{
new
Element
(
$"OK"
,
color
:
Color
.
FromArgb
(
0
,
255
,
0
))};
}
}
catch
(
Exception
e
)
{
Console
.
Error
.
WriteLine
(
e
);
return
new
Element
[]{
new
Element
(
"CM PE"
,
color
:
Color
.
Red
)};
}
}
}
[
ParserName
(
"offlineimap_status"
)]
class
ParserOfflineimapLog
:
Parser
{
public
void
Init
(
StatusBar
_bar
,
Module
_module
,
ConfigSection
section
)
{
}
public
IEnumerable
<
Element
>
Parse
(
string
data
)
{
data
=
data
.
Trim
();
if
(
data
.
StartsWith
(
"DOING"
))
return
new
Element
[]{
new
Element
(
"IMAP"
,
color
:
Color
.
Green
)};
if
(
data
.
StartsWith
(
"WAITING"
))
return
new
Element
[]{
new
Element
(
"IMAP"
,
color
:
Color
.
Orange
)};
if
(
int
.
TryParse
(
data
,
out
int
n
))
{
if
(
n
==
0
)
return
new
Element
[]{};
else
return
new
Element
[]{
new
Element
(
$"IMAP
{
n
}
"
,
color
:
Color
.
Red
)};
}
else
return
new
Element
[]{
new
Element
(
"IMAP PE"
,
color
:
Color
.
Red
)};
}
}
[
ParserName
(
"ICE_speed"
)]
[
ParserName
(
"ICE_speed"
)]
class
ParserICESpeed
:
Parser
class
ParserICESpeed
:
Parser
{
{
...
...
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