Method: Vmail::ReplyTemplating#reply_cc

Defined in:
lib/vmail/reply_templating.rb

#reply_ccObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vmail/reply_templating.rb', line 46

def reply_cc
  return nil unless (@replyall || @always_cc)
  xs = if @replyall
         ((current_mail['cc'] && current_mail['cc'].decoded) || "") .split(/,\s*/)  + ((current_mail['to'] && current_mail['to'].decoded) || "") .split(/,\s*/)
       else
         []
       end
  xs = xs.select {|x|
    email = (x[/<([^>]+)>/, 1] || x) 
    email !~ /#{reply_recipient}/ \
      && email !~ /#@username/ \
      && (@always_cc ? (email !~ /#{@always_cc}/) : true) 
  }
  if @always_cc 
    xs << @always_cc
  end
  xs.uniq.select {|x| x != reply_recipient }.join(', ')
end