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
16b779e8
Commit
16b779e8
authored
13 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
use user.alias instead of user.handle to identify. display notice on room entry/exit.
parent
a91682f0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/json-chat.js
+21
-8
21 additions, 8 deletions
exec/load/json-chat.js
with
21 additions
and
8 deletions
exec/load/json-chat.js
+
21
−
8
View file @
16b779e8
...
...
@@ -25,9 +25,9 @@ function JSONChat(usernum,jsonclient,host,port) {
if
(
usernum
>
0
&&
system
.
username
(
usernum
))
usr
=
new
User
(
usernum
);
if
(
usr
)
this
.
nick
=
new
Nick
(
usr
.
handle
,
system
.
name
,
usr
.
ip_address
);
this
.
nick
=
new
Nick
(
usr
.
alias
,
system
.
name
,
usr
.
ip_address
);
else
if
(
user
&&
user
.
number
>
0
)
this
.
nick
=
new
Nick
(
user
.
handle
,
system
.
name
,
user
.
ip_address
);
this
.
nick
=
new
Nick
(
user
.
alias
,
system
.
name
,
user
.
ip_address
);
if
(
this
.
nick
)
this
.
client
.
subscribe
(
"
chat
"
,
"
channels.
"
+
this
.
nick
.
name
+
"
.messages
"
);
else
...
...
@@ -88,25 +88,38 @@ function JSONChat(usernum,jsonclient,host,port) {
/* pass any client update packets to this function to process inbound messages/status updates */
this
.
update
=
function
(
packet
)
{
var
arr
=
packet
.
location
.
split
(
"
.
"
);
if
(
arr
.
shift
().
toUpperCase
()
!=
"
CHAT
"
)
return
false
;
var
channel
;
var
usr
;
var
message
;
while
(
arr
.
length
>
0
)
{
switch
(
arr
.
shift
().
toUpperCase
())
{
case
"
CHANNELS
"
:
channel
=
this
.
channels
[
arr
[
0
].
toUpperCase
()];
break
;
case
"
MESSAGES
"
:
channel
.
messages
.
push
(
packet
.
data
)
;
message
=
packet
.
data
;
break
;
case
"
USERS
"
:
usr
=
channel
.
users
[
arr
[
0
].
toUpperCase
()];
break
;
}
}
switch
(
packet
.
oper
.
toUpperCase
())
{
case
"
SUBSCRIBE
"
:
channel
.
messages
.
push
(
new
Message
(
""
,
packet
.
data
.
nick
+
"
is here.
"
,
Date
.
now
()));
break
;
case
"
UNSUBSCRIBE
"
:
channel
.
messages
.
push
(
new
Message
(
""
,
packet
.
data
.
nick
+
"
has left.
"
,
Date
.
now
()));
break
;
case
"
WRITE
"
:
channel
.
messages
.
push
(
message
);
break
;
default
:
log
(
LOG_WARNING
,
"
Unhandled response
"
);
break
;
}
return
true
;
}
...
...
@@ -152,7 +165,7 @@ function JSONChat(usernum,jsonclient,host,port) {
case
"
WHO
"
:
var
users
=
this
.
who
(
target
);
for
(
var
u
in
users
)
this
.
channels
[
target
.
toUpperCase
()].
message
s
.
push
(
users
[
u
]);
this
.
channels
[
target
.
toUpperCase
()].
user
s
.
push
(
users
[
u
]);
break
;
case
"
INVITE
"
:
break
;
...
...
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