Class: SkypeAPI::Chat

Inherits:
Object
  • Object
show all
Defined in:
lib/skype-api/chat.rb

Constant Summary collapse

@@chats =
Hash.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Chat

Returns a new instance of Chat.



26
27
28
# File 'lib/skype-api/chat.rb', line 26

def initialize(id)
  @id = id
end

Class Method Details

.bookmarked_chatsObject



16
17
18
19
# File 'lib/skype-api/chat.rb', line 16

def self.bookmarked_chats()
  recieved_chats = SkypeAPI::exec("SEARCH BOOKMARKEDCHATS");
  recieved_chats.sub("CHATS ","").split(", ").map {|chat| get_chat(chat)}
end

.chatsObject



4
5
6
7
# File 'lib/skype-api/chat.rb', line 4

def self.chats()
  recieved_chats = SkypeAPI::exec("SEARCH CHATS");
  recieved_chats.sub("CHATS ","").split(", ").map {|chat| get_chat(chat)}
end

.get_chat(id) ⇒ Object



20
21
22
23
24
25
# File 'lib/skype-api/chat.rb', line 20

def self.get_chat(id)
  if @@chats[id] == nil
    @@chats[id] = Chat.new(id);
  end
  @@chats[id];
end

.recent_chatsObject



8
9
10
11
# File 'lib/skype-api/chat.rb', line 8

def self.recent_chats()
  recieved_chats = SkypeAPI::exec("SEARCH RECENTCHATS");
  recieved_chats.sub("CHATS ","").split(", ").map {|chat| get_chat(chat)}
end

.unread_chatsObject



12
13
14
15
# File 'lib/skype-api/chat.rb', line 12

def self.unread_chats()
  recieved_chats = SkypeAPI::exec("SEARCH UNREADCHATS");
  recieved_chats.sub("CHATS ","").split(", ").map {|chat| get_chat(chat)}
end

Instance Method Details

#active_membersObject



53
54
55
# File 'lib/skype-api/chat.rb', line 53

def active_members
  get_prop("ACTIVEMEMBERS");
end

#adderObject



38
39
40
# File 'lib/skype-api/chat.rb', line 38

def adder
  get_prop("ADDER");
end

#creation_timestampObject



41
42
43
# File 'lib/skype-api/chat.rb', line 41

def creation_timestamp
  get_prop("TIMESTAMP");
end

#friendly_nameObject



56
57
58
59
# File 'lib/skype-api/chat.rb', line 56

def friendly_name
  get_prop("FRIENDLYNAME");

end

#idObject



35
36
37
# File 'lib/skype-api/chat.rb', line 35

def id
  @id
end

#membersObject



29
30
31
# File 'lib/skype-api/chat.rb', line 29

def members
  get_prop("MEMBERS").split(" ").map {|name| User.get_user(name)};
end

#messagesObject



50
51
52
# File 'lib/skype-api/chat.rb', line 50

def messages
  get_prop("RECENTCHATMESSAGES").split(", ").map {|message| Message.new(message)};
end

#post(msg) ⇒ Object



60
61
62
# File 'lib/skype-api/chat.rb', line 60

def post(msg)
  SkypeAPI::exec("CHATMESSAGE #{self.id} #{msg}");
end

#postersObject



47
48
49
# File 'lib/skype-api/chat.rb', line 47

def posters
  get_prop("POSTERS")
end

#set_topic(topic) ⇒ Object



63
64
65
# File 'lib/skype-api/chat.rb', line 63

def set_topic(topic)
  SkypeAPI::exec("SET CHAT #{self.id} TOPIC #{topic}");
end

#statusObject



44
45
46
# File 'lib/skype-api/chat.rb', line 44

def status
  get_prop("STATUS")
end

#to_sObject



66
67
68
# File 'lib/skype-api/chat.rb', line 66

def to_s
  @id.to_s
end

#topicObject



32
33
34
# File 'lib/skype-api/chat.rb', line 32

def topic
  get_prop("TOPIC");
end