Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
2cc864c5
Commit
2cc864c5
authored
Dec 26, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nothing
parent
1d260837
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1248 additions
and
1234 deletions
+1248
-1234
.gitattributes
.gitattributes
+10
-18
lib/game.rb
lib/game.rb
+50
-50
lib/main.rb
lib/main.rb
+134
-134
lib/update.rb
lib/update.rb
+146
-146
lib/window_chat.rb
lib/window_chat.rb
+175
-175
lib/window_lobbybuttons.rb
lib/window_lobbybuttons.rb
+55
-55
lib/window_userinfo.rb
lib/window_userinfo.rb
+35
-35
lib/ygocore/game.rb
lib/ygocore/game.rb
+643
-621
No files found.
.gitattributes
View file @
2cc864c5
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
*.rb text
*.yml text
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.html text
*.js text
*.coffee text
*.css text
*.less text
*.png binary
*.jpg binary
\ No newline at end of file
lib/game.rb
View file @
2cc864c5
lib/main.rb
View file @
2cc864c5
lib/update.rb
View file @
2cc864c5
...
...
@@ -2,7 +2,7 @@ require 'open-uri'
require
"fileutils"
require_relative
'card'
module
Update
Version
=
'0.8.
5'
Version
=
'0.8.
6'
URL
=
"http://my-card.in/mycard/update.json?version=
#{
Version
}
"
class
<<
self
attr_reader
:thumbnails
,
:images
,
:status
...
...
lib/window_chat.rb
View file @
2cc864c5
lib/window_lobbybuttons.rb
View file @
2cc864c5
lib/window_userinfo.rb
View file @
2cc864c5
lib/ygocore/game.rb
View file @
2cc864c5
...
...
@@ -29,20 +29,22 @@ class Ygocore < Game
@username
=
username
@password
=
password
@nickname_conflict
=
[]
@@im
=
Jabber
::
Client
.
new
(
Jabber
::
JID
::
new
(
@username
,
'my-card.in'
,
'mycard'
))
matched
=
@username
.
match
Jabber
::
JID
::
PATTERN
if
matched
[
1
]
&&
matched
[
2
]
@username
=
matched
[
1
]
jid
=
Jabber
::
JID
::
new
@username
,
matched
[
2
],
matched
[
3
]
||
'mycard'
else
jid
=
Jabber
::
JID
::
new
@username
,
'my-card.in'
,
'mycard'
end
@@im
=
Jabber
::
Client
.
new
(
jid
)
@@im_room
=
Jabber
::
MUC
::
MUCClient
.
new
(
@@im
)
Jabber
.
logger
=
$log
Jabber
.
debug
=
true
@@im
.
on_exception
do
|
exception
,
c
,
where
|
$log
.
error
(
'聊天出错'
)
{
[
exception
,
c
,
where
]
}
if
where
==
:close
Game_Event
.
push
(
Game_Event
::
Chat
.
new
(
ChatMessage
.
new
(
User
.
new
(
:system
,
'System'
),
'聊天服务连接中断'
)))
else
Game_Event
.
push
(
Game_Event
::
Chat
.
new
(
ChatMessage
.
new
(
User
.
new
(
:system
,
'System'
),
'聊天服务连接中断.1'
)))
#sleep 5
#im_connect
end
Game_Event
.
push
(
Game_Event
::
Chat
.
new
(
ChatMessage
.
new
(
User
.
new
(
:system
,
'System'
),
'聊天服务连接中断: '
+
exception
.
to_s
)))
end
@@im_room
.
add_message_callback
do
|
m
|
user
=
m
.
from
.
resource
==
nickname
?
@user
:
User
.
new
(
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
)
...
...
@@ -86,7 +88,7 @@ class Ygocore < Game
self
.
servers
.
replace
JSON
.
parse
(
http
.
response
).
collect
{
|
data
|
Server
.
new
(
data
[
'id'
],
data
[
'name'
],
data
[
'ip'
],
data
[
'port'
],
data
[
'auth'
])}
self
.
filter
[
:servers
]
=
self
.
servers
.
clone
rescue
Game_Event
.
push
Game_Event
::
Error
.
new
(
'ygocore'
,
'读取服务器列表失败
'
,
true
)
Game_Event
.
push
Game_Event
::
Error
.
new
(
'ygocore'
,
'读取服务器列表失败
.1'
,
true
)
end
#EventMachine::connect "mycard-server.my-card.in", 9997, Client
...
...
@@ -113,7 +115,27 @@ class Ygocore < Game
begin
@@im
.
allow_tls
=
false
@@im
.
use_ssl
=
true
@@im
.
connect
(
'chat.my-card.in'
,
5223
)
#ruby19/windows下 使用tls连接时会卡住
#由于XMPP4r在windows
srv
=
[]
Resolv
::
DNS
.
open
{
|
dns
|
# If ruby version is too old and SRV is unknown, this will raise a NameError
# which is caught below
Jabber
::
debuglog
(
"RESOLVING:
\n
_xmpp-client._tcp.
#{
@@im
.
jid
.
domain
}
(SRV)"
)
srv
=
dns
.
getresources
(
"_xmpp-client._tcp.
#{
@@im
.
jid
.
domain
}
"
,
Resolv
::
DNS
::
Resource
::
IN
::
SRV
)
}
# Sort SRV records: lowest priority first, highest weight first
srv
.
sort!
{
|
a
,
b
|
(
a
.
priority
!=
b
.
priority
)
?
(
a
.
priority
<=>
b
.
priority
)
:
(
b
.
weight
<=>
a
.
weight
)
}
srv
.
each
{
|
record
|
begin
@@im
.
connect
(
record
.
target
.
to_s
,
5223
)
# Success
break
rescue
SocketError
,
Errno
::
ECONNREFUSED
# Try next SRV record
end
}
begin
@@im
.
auth
(
@password
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment