lib/ronin/network/extensions/pop3/net.rb in ronin-support-0.3.0 vs lib/ronin/network/extensions/pop3/net.rb in ronin-support-0.4.0.rc1

- old
+ new

@@ -17,78 +17,8 @@ # along with Ronin Support. If not, see <http://www.gnu.org/licenses/>. # require 'ronin/network/pop3' -require 'net/pop' - module Net - # - # Creates a connection to the POP3 server. - # - # @param [String] host - # The host to connect to. - # - # @param [Hash] options - # Additional options. - # - # @option options [Integer] :port (Ronin::Network::POP3.default_port) - # The port the POP3 server is running on. - # - # @option options [String] :user - # The user to authenticate with when connecting to the POP3 server. - # - # @option options [String] :password - # The password to authenticate with when connecting to the POP3 server. - # - # @yield [session] - # If a block is given, it will be passed the newly created POP3 session. - # - # @yieldparam [Net::POP3] session - # The newly created POP3 session. - # - # @return [Net::POP3] - # The newly created POP3 session. - # - # @api public - # - def Net.pop3_connect(host,options={}) - host = host.to_s - port = (options[:port] || Ronin::Network::POP3.default_port) - user = options[:user] - password = options[:password] - - session = Net::POP3.start(host,port,user,password) - - yield session if block_given? - return session - end - - # - # Starts a session with the POP3 server. - # - # @param [String] host - # The host to connect to. - # - # @param [Hash] options - # Additional options. - # - # @yield [session] - # If a block is given, it will be passed the newly created POP3 session. - # After the block has returned, the session will be closed. - # - # @yieldparam [Net::POP3] session - # The newly created POP3 session. - # - # @return [nil] - # - # @api public - # - def Net.pop3_session(host,options={}) - session = Net.pop3_connect(host,options) - - yield session if block_given? - - session.finish - return nil - end + extend Ronin::Network::POP3 end