| 198 | | ret = api("statuses/update", {"status" => message}) |
| | 198 | # XXX: !list nick でユーザーの発言を表示させてみる試み |
| | 199 | if message =~ /^!list ([A-Za-z0-9_]+)$/ |
| | 200 | nick = $1 |
| | 201 | @log.debug([ nick, message ]) |
| | 202 | res = api('statuses/user_timeline', { 'id' => nick }).reverse_each do |s| |
| | 203 | @log.debug(s) |
| | 204 | mesg = "#{generate_status_message(s)}" |
| | 205 | post(nick, NOTICE, main_channel, mesg) |
| | 206 | end |
| | 207 | |
| | 208 | unless res |
| | 209 | post nil, ERR_NOSUCHNICK, nick, "No such nick/channel" |
| | 210 | end |
| | 211 | ret = true |
| | 212 | else |
| | 213 | ret = api("statuses/update", {"status" => message}) |
| | 214 | end |
| 314 | | mesg = s["text"] |
| 315 | | |
| 316 | | # added @user in no use @user reply message ( Wassr only ) |
| 317 | | if s.has_key?('reply_status_url') and s['reply_status_url'] and s['text'] !~ /^@.*/ and %r{([^/]+)/statuses/[^/]+}.match(s['reply_status_url']) |
| 318 | | reply_user_id = $1 |
| 319 | | mesg = "@#{reply_user_id} #{mesg}" |
| 320 | | end |
| 321 | | # display area name(Wassr only) |
| 322 | | if s.has_key?('areaname') and s["areaname"] |
| 323 | | mesg += " L: #{s['areaname']}" |
| 324 | | end |
| 325 | | # display photo url(Wassr only) |
| 326 | | if s.has_key?('photo_url') and s["photo_url"] |
| 327 | | mesg += " #{s['photo_url']}" |
| 328 | | end |
| 329 | | |
| 330 | | # time = Time.parse(s["created_at"]) rescue Time.now |
| 331 | | m = { """ => "\"", "<"=> "<", ">"=> ">", "&"=> "&", "\n" => " "} |
| 332 | | mesg.gsub!(/(#{m.keys.join("|")})/) { m[$1] } |
| | 330 | mesg = generate_status_message(s) |
| | 347 | end |
| | 348 | |
| | 349 | def generate_status_message(status) |
| | 350 | s = status |
| | 351 | mesg = s["text"] |
| | 352 | @log.debug(mesg) |
| | 353 | |
| | 354 | # added @user in no use @user reply message ( Wassr only ) |
| | 355 | if s.has_key?('reply_status_url') and s['reply_status_url'] and s['text'] !~ /^@.*/ and %r{([^/]+)/statuses/[^/]+}.match(s['reply_status_url']) |
| | 356 | reply_user_id = $1 |
| | 357 | mesg = "@#{reply_user_id} #{mesg}" |
| | 358 | end |
| | 359 | # display area name(Wassr only) |
| | 360 | if s.has_key?('areaname') and s["areaname"] |
| | 361 | mesg += " L: #{s['areaname']}" |
| | 362 | end |
| | 363 | # display photo url(Wassr only) |
| | 364 | if s.has_key?('photo_url') and s["photo_url"] |
| | 365 | mesg += " #{s['photo_url']}" |
| | 366 | end |
| | 367 | |
| | 368 | # time = Time.parse(s["created_at"]) rescue Time.now |
| | 369 | m = { """ => "\"", "<"=> "<", ">"=> ">", "&"=> "&", "\n" => " "} |
| | 370 | mesg.gsub!(/(#{m.keys.join("|")})/) { m[$1] } |
| | 371 | mesg |