Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
3168404f
Commit
3168404f
authored
6 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Basic CTRL-A to mIRC colour code conversion (foreground with bright/normal only for now).
ctrl_a_to_mirc(str) returns converted str.
parent
1f955a87
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/ircbot_functions.js
+67
-6
67 additions, 6 deletions
exec/load/ircbot_functions.js
with
67 additions
and
6 deletions
exec/load/ircbot_functions.js
+
67
−
6
View file @
3168404f
...
...
@@ -29,15 +29,15 @@ function Server_command(srv,cmdline,onick,ouh) {
if
(
chan
&&
chan
.
modules
[
m
]
!=
true
)
{
continue
;
}
if
(
module
&&
module
.
enabled
if
(
module
&&
module
.
enabled
&&
module
.
Server_Commands
[
main_cmd
])
{
try
{
cmd
=
IRC_parsecommand
(
cmdline
);
if
(
cmd
===
0
)
return
;
cmd
.
shift
();
module
.
Server_Commands
[
main_cmd
](
srv
,
cmd
,
onick
,
ouh
);
module
.
Server_Commands
[
main_cmd
](
srv
,
cmd
,
onick
,
ouh
);
}
catch
(
e
)
{
log
(
m
+
"
module error:
"
+
e
);
module
.
enabled
=
false
;
...
...
@@ -103,7 +103,7 @@ function Server_bot_command(srv,bot_cmds,target,onick,ouh,cmdline) {
var
cmd
=
IRC_parsecommand
(
cmdline
);
if
(
cmd
===
0
)
return
0
;
var
access_level
=
srv
.
bot_access
(
onick
,
ouh
);
var
botcmd
=
bot_cmds
[
cmd
[
0
].
toUpperCase
()];
if
(
botcmd
)
{
...
...
@@ -156,10 +156,10 @@ function Server_bot_access(nick,uh) { // return the access level of this user.
function
Server_writeout
(
str
)
{
log
(
"
-->
"
+
this
.
host
+
"
:
"
+
str
);
var
target
=
"
~
"
;
var
target_buffer
=
false
;
for
(
t
=
0
;
t
<
this
.
buffers
.
length
;
t
++
)
{
if
(
this
.
buffers
[
t
].
target
==
target
)
{
target_buffer
=
this
.
buffers
[
t
];
...
...
@@ -324,3 +324,64 @@ function login_user(usr) {
usr
.
connection
=
"
IRC
"
;
usr
.
logontime
=
time
();
}
function
ctrl_a_to_mirc
(
s
)
{
var
ctrl_a
=
false
;
var
bright
=
false
;
var
ret
=
''
;
function
add_fg_colour
(
nn
,
nb
)
{
ret
+=
ascii
(
3
)
+
(
bright
?
nb
:
nn
);
}
s
=
s
.
split
(
''
);
while
(
s
.
length
)
{
var
c
=
s
.
shift
();
if
(
c
==
'
\
1
'
)
{
ctrl_a
=
true
;
}
else
if
(
ctrl_a
)
{
switch
(
c
.
toUpperCase
())
{
case
'
H
'
:
bright
=
true
;
break
;
case
'
N
'
:
bright
=
false
;
break
;
case
'
K
'
:
add_fg_colour
(
1
,
14
);
break
;
case
'
R
'
:
add_fg_colour
(
4
,
7
);
// Red -> light red, high red -> orange
break
;
case
'
G
'
:
add_fg_colour
(
3
,
9
);
break
;
case
'
Y
'
:
add_fg_colour
(
5
,
8
);
break
;
case
'
B
'
:
add_fg_colour
(
2
,
12
);
break
;
case
'
M
'
:
add_fg_colour
(
6
,
13
);
break
;
case
'
C
'
:
add_fg_colour
(
10
,
11
);
break
;
case
'
W
'
:
add_fg_colour
(
15
,
0
);
break
;
default
:
break
;
}
ctrl_a
=
false
;
}
else
{
set_fg
=
false
;
ret
+=
c
;
}
}
return
ret
;
}
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