+ @title = t 'message.read.title'
+ @message = Message.find(params[:message_id])
+
+ if @message.to_user_id == @user.id or @message.from_user_id == @user.id then
+ @message.message_read = true if @message.to_user_id == @user.id
+ @message.save
+ else
+ flash[:notice] = t 'message.read.wrong_user', :user => @user.display_name
+ redirect_to :controller => "user", :action => "login", :referer => request.fullpath
+ end
+ rescue ActiveRecord::RecordNotFound
+ @title = t'message.no_such_message.title'
+ render :action => 'no_such_message', :status => :not_found
+ end
+
+ # Display the list of messages that have been sent to the user.
+ def inbox
+ @title = t 'message.inbox.title'
+ if @user and params[:display_name] == @user.display_name
+ else
+ redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
+ end
+ end
+
+ # Display the list of messages that the user has sent to other users.
+ def outbox
+ @title = t 'message.outbox.title'
+ if @user and params[:display_name] == @user.display_name
+ else
+ redirect_to :controller => 'message', :action => 'outbox', :display_name => @user.display_name
+ end
+ end
+
+ # Set the message as being read or unread.
+ def mark