synacrb 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb153533096ac14331d01c6e84d065b07cdd6c4e
4
- data.tar.gz: a4cf5df045fd3430208a0b8c7bf1087ca365ab52
3
+ metadata.gz: f2a86ffcf864c1c52ef8f62231b6fb2d098d217f
4
+ data.tar.gz: 8d5cb8688ecf2390fa1d7bdee94fbc90fa6a51a9
5
5
  SHA512:
6
- metadata.gz: 256dec217b8b609d41141a3226ba9c9bc43ef60c8c440b8a494903737c1967e03322a6d99a2dd470f1c44e3bab4eb13ec79364e589873c637beb7d3326456d53
7
- data.tar.gz: 7f03ec68e9186ab0ff41966768f63be1768ee64c3caf0151e426c0a7ad0dd7a1486ec0de0ab90d0c22ae2b3db051638d9b12645fb6ea4981e62a920ef65d3383
6
+ metadata.gz: be7827c0d1cc992564e4bed849feb150588b1c1321c097a58b107b694cbce10c39aa662563a057d9f8dfbbe83356bc61772a9f8ab824daa32a10f5b5900b4cf6
7
+ data.tar.gz: 3bad3e5d8c38897c359dfad211c8416cdc24929d12ded6f0b962bfb05c50b5b8905fc587c29f68b5999322c2c74c7068d96a07fd846e005a97d80b9668a5422b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synacrb (0.2.0)
4
+ synacrb (0.3.0)
5
5
  msgpack (~> 1.2)
6
6
  openssl (~> 2.1)
7
7
 
@@ -21,4 +21,4 @@ DEPENDENCIES
21
21
  synacrb!
22
22
 
23
23
  BUNDLED WITH
24
- 1.16.0
24
+ 1.16.1
@@ -10,19 +10,19 @@ module Synacrb
10
10
 
11
11
  LIMIT_BULK = 64
12
12
 
13
- ERR_ALREADY_EXISTS = 1
14
- ERR_LIMIT_REACHED = 2
15
- ERR_LOGIN_BANNED = 3
16
- ERR_LOGIN_BOT = 4
17
- ERR_LOGIN_INVALID = 5
18
- ERR_MAX_CONN_PER_IP = 6
19
- ERR_MISSING_FIELD = 7
20
- ERR_MISSING_PERMISSION = 8
21
- ERR_SELF_PM = 9
22
- ERR_UNKNOWN_BOT = 10
23
- ERR_UNKNOWN_CHANNEL = 11
24
- ERR_UNKNOWN_MESSAGE = 12
25
- ERR_UNKNOWN_USER = 13
13
+ ERR_ALREADY_EXISTS = 0
14
+ ERR_LIMIT_REACHED = 1
15
+ ERR_LOGIN_BANNED = 2
16
+ ERR_LOGIN_BOT = 3
17
+ ERR_LOGIN_INVALID = 4
18
+ ERR_MAX_CONN_PER_IP = 5
19
+ ERR_MISSING_FIELD = 6
20
+ ERR_MISSING_PERMISSION = 7
21
+ ERR_SELF_PM = 8
22
+ ERR_UNKNOWN_BOT = 9
23
+ ERR_UNKNOWN_CHANNEL = 10
24
+ ERR_UNKNOWN_MESSAGE = 11
25
+ ERR_UNKNOWN_USER = 12
26
26
 
27
27
  PERM_READ = 1
28
28
  PERM_WRITE = 1 << 1
@@ -38,33 +38,32 @@ module Synacrb
38
38
  User = Struct.new(:admin, :ban, :bot, :id, :modes, :name)
39
39
 
40
40
  # CLIENT PACKETS
41
- PACKET_CLOSE_ID = 0; Close = Class.new
42
- PACKET_ERR_ID = 1;
43
- PACKET_RATELIMIT_ID = 2;
44
- PACKET_CHANNELCREATE_ID = 3; ChannelCreate = Struct.new(:default_mode_bot, :default_mode_user, :name, :recipient)
45
- PACKET_CHANNELDELETE_ID = 4; ChannelDelete = Struct.new(:id)
46
- PACKET_CHANNELUPDATE_ID = 5; ChannelUpdate = Struct.new(:inner)
47
- PACKET_COMMAND_ID = 6; Command = Struct.new(:args, :recipient)
48
- PACKET_LOGIN_ID = 7; Login = Struct.new(:bot, :name, :password, :token)
49
- PACKET_LOGINUPDATE_ID = 8; LoginUpdate = Struct.new(:name, :password_current, :password_new, :reset_token)
50
- PACKET_MESSAGECREATE_ID = 9; MessageCreate = Struct.new(:channel, :text)
51
- PACKET_MESSAGEDELETE_ID = 10; MessageDelete = Struct.new(:id)
52
- PACKET_MESSAGEDELETEBULK_ID = 11; MessageDeleteBulk = Struct.new(:channel, :ids)
53
- PACKET_MESSAGELIST_ID = 12; MessageList = Struct.new(:after, :before, :channel, :limit)
54
- PACKET_MESSAGEUPDATE_ID = 13; MessageUpdate = Struct.new(:id, :text)
55
- PACKET_TYPING_ID = 14; Typing = Struct.new(:channel)
56
- PACKET_USERUPDATE_ID = 15; UserUpdate = Struct.new(:admin, :ban, :channel_mode, :id)
41
+ PACKET_ERR_ID = 0;
42
+ PACKET_RATELIMIT_ID = 1;
43
+ PACKET_CHANNELCREATE_ID = 2; ChannelCreate = Struct.new(:default_mode_bot, :default_mode_user, :name, :recipient)
44
+ PACKET_CHANNELDELETE_ID = 3; ChannelDelete = Struct.new(:id)
45
+ PACKET_CHANNELUPDATE_ID = 4; ChannelUpdate = Struct.new(:inner)
46
+ PACKET_COMMAND_ID = 5; Command = Struct.new(:args, :recipient)
47
+ PACKET_LOGIN_ID = 6; Login = Struct.new(:bot, :name, :password, :token)
48
+ PACKET_LOGINUPDATE_ID = 7; LoginUpdate = Struct.new(:name, :password_current, :password_new, :reset_token)
49
+ PACKET_MESSAGECREATE_ID = 8; MessageCreate = Struct.new(:channel, :text)
50
+ PACKET_MESSAGEDELETE_ID = 9; MessageDelete = Struct.new(:id)
51
+ PACKET_MESSAGEDELETEBULK_ID = 10; MessageDeleteBulk = Struct.new(:channel, :ids)
52
+ PACKET_MESSAGELIST_ID = 11; MessageList = Struct.new(:after, :before, :channel, :limit)
53
+ PACKET_MESSAGEUPDATE_ID = 12; MessageUpdate = Struct.new(:id, :text)
54
+ PACKET_TYPING_ID = 13; Typing = Struct.new(:channel)
55
+ PACKET_USERUPDATE_ID = 14; UserUpdate = Struct.new(:admin, :ban, :channel_mode, :id)
57
56
 
58
57
  # SERVER PACKETS
59
- PACKET_CHANNELDELETERECEIVE_ID = 16; ChannelDeleteReceive = Struct.new(:inner)
60
- PACKET_CHANNELRECEIVE_ID = 17; ChannelReceive = Struct.new(:inner)
61
- PACKET_COMMANDRECEIVE_ID = 18; CommandReceive = Struct.new(:args, :author)
62
- PACKET_LOGINSUCCESS_ID = 19; LoginSuccess = Struct.new(:created, :id, :token)
63
- PACKET_MESSAGEDELETERECEIVE_ID = 20; MessageDeleteReceive = Struct.new(:id)
64
- PACKET_MESSAGELISTRECEIVED_ID = 21; MessageListReceived = Struct.new(:id)
65
- PACKET_MESSAGERECEIVE_ID = 22; MessageReceive = Struct.new(:inner, :new)
66
- PACKET_TYPINGRECEIVE_ID = 23; TypingReceive = Struct.new(:author, :channel)
67
- PACKET_USERRECEIVE_ID = 24; UserReceive = Struct.new(:inner)
58
+ PACKET_CHANNELDELETERECEIVE_ID = 15; ChannelDeleteReceive = Struct.new(:inner)
59
+ PACKET_CHANNELRECEIVE_ID = 16; ChannelReceive = Struct.new(:inner)
60
+ PACKET_COMMANDRECEIVE_ID = 17; CommandReceive = Struct.new(:args, :author)
61
+ PACKET_LOGINSUCCESS_ID = 18; LoginSuccess = Struct.new(:created, :id, :token)
62
+ PACKET_MESSAGEDELETERECEIVE_ID = 19; MessageDeleteReceive = Struct.new(:id)
63
+ PACKET_MESSAGELISTRECEIVED_ID = 20; MessageListReceived = Struct.new(:id)
64
+ PACKET_MESSAGERECEIVE_ID = 21; MessageReceive = Struct.new(:inner, :new)
65
+ PACKET_TYPINGRECEIVE_ID = 22; TypingReceive = Struct.new(:author, :channel)
66
+ PACKET_USERRECEIVE_ID = 23; UserReceive = Struct.new(:inner)
68
67
 
69
68
  def self.encode_u16(input)
70
69
  (input >> 8).chr + (input % 256).chr
@@ -75,8 +74,6 @@ module Synacrb
75
74
 
76
75
  def self.packet_from_id(id)
77
76
  case id
78
- when PACKET_CLOSE_ID
79
- Close
80
77
  when PACKET_CHANNELCREATE_ID
81
78
  ChannelCreate
82
79
  when PACKET_CHANNELDELETE_ID
@@ -124,9 +121,7 @@ module Synacrb
124
121
  end
125
122
  end
126
123
  def self.packet_to_id(packet)
127
- if packet.instance_of? Close
128
- PACKET_CLOSE_ID
129
- elsif packet.instance_of? ChannelCreate
124
+ if packet.instance_of? ChannelCreate
130
125
  PACKET_CHANNELCREATE_ID
131
126
  elsif packet.instance_of? ChannelDelete
132
127
  PACKET_CHANNELDELETE_ID
@@ -1,3 +1,3 @@
1
1
  module Synacrb
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/synacrb.rb CHANGED
@@ -21,8 +21,8 @@ module Synacrb
21
21
 
22
22
  class Session
23
23
  # Connect to the server
24
- def initialize(addr, hash, &callback)
25
- tcp = TCPSocket.new addr, 8439
24
+ def initialize(addr, hash, port = Common::DEFAULT_PORT, &callback)
25
+ tcp = TCPSocket.new addr, port
26
26
 
27
27
  @hash = hash
28
28
 
@@ -85,7 +85,6 @@ module Synacrb
85
85
 
86
86
  # Close the connection
87
87
  def close()
88
- send(Common::Close)
89
88
  @stream.close
90
89
  end
91
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synacrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jD91mZM2
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-02 00:00:00.000000000 Z
11
+ date: 2018-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack