public
Homepage: http://www.inoutopen.com
Clone URL: git://github.com/jwulff/in_out_open.git
Search Repo:
added message styling
jwulff (author)
Mon May 12 22:06:06 -0700 2008
commit  7e068f00e304135ec36669f6b34948efbecef88f
tree    291e5cb01ef5ee02a8bb543a5e0a6b858a011ed8
parent  19adf04a4dc9e23def7345e4b95a08c928afce3a
...
47
48
49
50
 
 
 
 
 
 
 
 
 
 
 
 
 
51
52
53
...
47
48
49
 
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
0
@@ -47,7 +47,19 @@ class JabberDRbServer
0
   end
0
   
0
   def get_message(text, to = nil)
0
- jabber_message = Jabber::Message.new to, text
0
+ html = REXML::Element::new 'html'
0
+ html.add_namespace 'http://jabber.org/protocol/xhtml-im'
0
+
0
+ body = REXML::Element::new 'body'
0
+ body.add_namespace 'http://www.w3.org/1999/xhtml'
0
+
0
+ text = REXML::Text.new text, false, nil, true, nil, %r/.^/
0
+
0
+ body.add text
0
+ html.add body
0
+
0
+ jabber_message = Jabber::Message.new to, nil
0
+ jabber_message.add_element html
0
   end
0
   
0
   def send_message_to_jabber_room(jabber_id, jabber_password, jabber_room, message)
...
7
8
9
10
 
11
12
13
...
17
18
19
20
21
22
23
 
 
 
 
 
 
 
 
24
...
7
8
9
 
10
11
12
13
...
17
18
19
 
 
20
21
22
23
24
25
26
27
28
29
30
0
@@ -7,7 +7,7 @@ class Message < ActiveRecord::Base
0
               lambda { |user| { :conditions => [ 'team_users.user_id = ?', user.id ],
0
                                 :include => { :team => :team_users }, :order => 'messages.created_at DESC' } }
0
   
0
- def summary
0
+ def description
0
     out = "#{self.user} "
0
     if self.kind_of?(Event)
0
       out += "added an event "
0
@@ -17,8 +17,14 @@ class Message < ActiveRecord::Base
0
     out += "in "
0
     out += "#{self.team}"
0
     out += " to" if self.kind_of?(Status)
0
- out += ": "
0
- out += "#{self.text}"
0
     return out
0
   end
0
+
0
+ def summary
0
+ "#{self.description}: #{self.text}"
0
+ end
0
+
0
+ def jabber_summary
0
+ "<font color='#cccccc'>#{self.description}:</font> #{self.text}"
0
+ end
0
 end
...
18
19
20
21
 
22
23
24
...
32
33
34
35
 
36
37
38
...
18
19
20
 
21
22
23
24
...
32
33
34
 
35
36
37
38
0
@@ -18,7 +18,7 @@ class MessageJabberObserver < ActiveRecord::Observer
0
         jabber_drb_server.send_message_to_jabber_room message.team.jabber_id,
0
                                                       message.team.jabber_password,
0
                                                       message.team.jabber_room,
0
- message.summary
0
+ message.jabber_summary
0
       rescue => e
0
         ActiveRecord::Base.logger.error e.message
0
         ActiveRecord::Base.logger.error e.backtrace.join("\n")
0
@@ -32,7 +32,7 @@ class MessageJabberObserver < ActiveRecord::Observer
0
         jabber_drb_server.send_message_to_jabber_id message.team.jabber_id,
0
                                                     message.team.jabber_password,
0
                                                     user.jabber_id,
0
- message.summary
0
+ message.jabber_summary
0
       rescue => e
0
         ActiveRecord::Base.logger.error e.message
0
         ActiveRecord::Base.logger.error e.backtrace.join("\n")

Comments

    No one has commented yet.