Module: GG

Defined in:
lib/GRuby/GG.rb,
lib/GRuby/GG_utils.rb,
lib/GRuby/GG_packets.rb,
lib/GRuby/GG_constants.rb

Defined Under Namespace

Modules: PACKET_LIST_EMPTY, PACKET_LOGIN60, PACKET_NEW_STATUS, PACKET_RECV_MSG, PACKET_SEND_MSG, PACKET_SEND_MSG_ACK, PACKET_WELCOME Classes: PACKET, Session

Constant Summary

HEADER =
0x0000
NEW_STATUS =
0x0002
PONG =
0x0007
PING =
0x0008
SEND_MSG =
0x000b
LOGIN =
0x000c
ADD_NOTIFY =
0x000d
REMOVE_NOTIFY =
0x000e
NOTIFY_FIRST =
0x000f
NOTIFY_LAST =
0x0010
LIST_EMPTY =
0x0012
LOGIN_EXT =
0x0013
PUBDIR50_REQUEST =
0x0014
LOGIN60 =
0x0015
USERLIST_REQUEST =
0x0016
WELCOME =
0x0001
STATUS =
0x0002
LOGIN_OK =
0x0003
SEND_MSG_ACK =
0x0005
LOGIN_FAILED =
0x0009
RECV_MSG =
0x000a
DISCONNECTING =
0x000b
NOTIFY_REPLY =
0x000c
PUBDIR50_REPLY =
0x000e
STATUS60 =
0x000f
USERLIST_REPLY =
0x0010
NOTIFY_REPLY60 =
0x0011
NEED_EMAIL =
0x0014
STATUS_NOT_AVAIL =
0x0001
STATUS_NOT_AVAIL_DESCR =
0x0015
STATUS_AVAIL =
0x0002
STATUS_AVAIL_DESCR =
0x0004
STATUS_BUSY =
0x0003
STATUS_BUSY_DESCR =
0x0005
STATUS_INVISIBLE =
0x0014
STATUS_INVISIBLE_DESCR =
0x0016
STATUS_BLOCKED =
0x0006
STATUS_FRIENDS_MASK =
0x8000

Class Method Summary collapse

Class Method Details

.connection_paramsObject

Return connection params returned from gg server.



40
41
42
43
44
45
46
47
48
49
# File 'lib/GRuby/GG_utils.rb', line 40

def self.connection_params
  require 'open-uri'
	gg_connection = open("http://appmsg.gadu-gadu.pl/appsvc/appmsg4.asp?fmnumber=").readlines[0].split(/\s/)[2].split(':')
	gg_connection_param = { 
  	'host' => gg_connection[0],
  	'port' => gg_connection[1]
  }
  puts ":: Connection params ... host:#{gg_connection_param['host']} port:#{gg_connection_param['port']}" if $DEBUG
  return gg_connection_param
end

.login_hash(password, seed) ⇒ Object

Return calculated password hash.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/GRuby/GG_utils.rb', line 6

def self. ( password, seed )
  x = 0;
  y = seed;
  z = 0;

  password.each_byte do |char|
    x = ( x & 0xffffff00 ) | char.to_i
    y ^= x;
    y &= 0xffffffff
    y += x;
    y &= 0xffffffff
    x <<= 8;
    x &= 0xffffffff
    y ^= x;
    y &= 0xffffffff
    x <<= 8;
    x &= 0xffffffff
    y -= x;
    y &= 0xffffffff
    x <<= 8;
    x &= 0xffffffff
    y ^= x;
    y &= 0xffffffff
    z = y & 0x1f;
    z &= 0xffffffff
    y = (y << z) | (y >> (32 - z))
    y &= 0xffffffff
  end
  return y;
end

.new_session(params) ⇒ Object

Return new GG session



6
7
8
# File 'lib/GRuby/GG.rb', line 6

def self.new_session( params )
  Session.new( params )
end