next step on my python irc client?

Jan 1, 2014 at 6:46am
closed account (Dy7SLyTq)
so i have fleshed out a rough class for my v2.7.3 irc class. it connects to irc.quakenet.org and prints this:
NOTICE AUTH :*** Looking up your hostname

NOTICE AUTH :*** Checking Ident
NOTICE AUTH :*** Couldn't look up your hostname

NOTICE AUTH :*** No ident response
then exits. here is my class:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#! /usr/bin/env python

# Modules to import
import socket # for connecting to the server
import    sys # for exit

# IRC Session class to abstract the session
# (and make my life easier)
class IRC:
    """IRC Session class to abstract the data""" # irc class bio

    # *private* data members
    __Host__         = "irc.quakenet.org"                 # server to connect to
    __Channel__      = "#cplusplus"                       # channel hosted by sever
    __Port__         = 6667                               # port to use
    __ServerSocket__ = socket.socket()                    # socket to use to connect to host
    __Nick__         = "DTSCode-Bot"                      # nickname when talking
    __User__         = "DTSCode-Bot"                      # session username
    __Pass__         = "pass"                             # session password (not neccesary)
    __Info__         = "An irc bot class made by DTSCode" # bio about the user

    # start setters
    def SetHost(self, Server):
        __Host__ = Server
        return

    def SetChannel(self, Channel):
        __Channel__ = Channel
        return

    def SetPort(self, Port):
        __Port__ = Port
        return

    def SetNick(self, Nickname):
        __Nick__ = Nickname
        return

    def SetUser(self, Username):
        __User__ = Username
        return

    def SetPass(self, Password):
        __Pass__ = Password
        return

    def SetInfo(self, Bio):
        __Info__ = Bio
        return
    # end setters

    # start getters
    def GetHost(self):
        return __Host__

    def GetChannel(self):
        return __Channel__

    def GetPort(self):
        return __Port__

    def GetNick(self):
        return __Nick__

    def GetUser(self):
        return __User__

    def GetPass(self):
        return __Pass__

    def GetInfo(self):
        return __Info__
    # end getters

    # start misc functions
    def Connect(self): # connect to the host and test for errors
        try:
            self.__ServerSocket__ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.__ServerSocket__.connect((self.__Host__, self.__Port__))

        except socket.error, Message:
            print "Error " + str(Message[0]) +": " + Message[1]
            sys.exit();

        return

    def Join(self):
        return

    def GetNamesList(self):
        return

    def Send(self, Message):
        self.__ServerSocket__.send(Message)
        return

    def Recv(self, Bytes = 1024):
        print self.__ServerSocket__.recv(Bytes)
        return

    def Close(self):
        self.__ServerSocket__.close()
        return

    def ParseCommand(self):
        return
    # end misc functions

session = IRC()
session.Connect()
session.Send("Hello, world!")
session.Recv()
session.Close()

what do i need to do next? i know that its not a good thing to ask, but for the first time in a while im working on a project that i dont even know enough to know what to ask

edit: and also, this works on linux but i havent tested it on windows yet
Last edited on Jan 1, 2014 at 6:56am
Jan 1, 2014 at 8:33am
1) Read through the irc specification. This might be helpful: https://tools.ietf.org/html/rfc2812
2) Ensure that your program correctly connects to the irc server.
3) Start allowing user functionality / bot functionality (depending on type of project).

Hope this helps.
Jan 1, 2014 at 8:42am
closed account (Dy7SLyTq)
ok while im reading up on the rfc can you see if you can help (and that helped a lot thanks)? here is my updated code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#! /usr/bin/env python

# Modules to import
import socket # for connecting to the server
import    sys # for exit

# IRC Session class to abstract the session
# (and make my life easier)
class IRC:
    """IRC Session class to abstract the data""" # irc class bio

    # *private* data members
    __Host__         = "irc.quakenet.org"                 # server to connect to
    __Channel__      = "#cplusplus"                       # channel hosted by sever
    __Port__         = 6667                               # port to use
    __ServerSocket__ = socket.socket()                    # socket to use to connect to host
    __Nick__         = "DTSCode-Bot"                      # nickname when talking
    __User__         = "DTSCode-Bot"                      # session username
    __RealName__     = "DTSCode-Bot"                      # real name
    __Pass__         = "pass"                             # session password (not neccesary)
    __Info__         = "An irc bot class made by DTSCode" # bio about the user

    # start setters
    def SetHost(self, Server):
        __Host__ = Server
        return

    def SetChannel(self, Channel):
        __Channel__ = Channel
        return

    def SetPort(self, Port):
        __Port__ = Port
        return

    def SetNick(self, Nickname):
        __Nick__ = Nickname
        return

    def SetUser(self, Username):
        __User__ = Username
        return

    def SetRealName(self, RealName):
        __RealName__ = RealName
        return

    def SetPass(self, Password):
        __Pass__ = Password
        return

    def SetInfo(self, Bio):
        __Info__ = Bio
        return
    # end setters

    # start getters
    def GetHost(self):
        return __Host__

    def GetChannel(self):
        return __Channel__

    def GetPort(self):
        return __Port__

    def GetNick(self):
        return __Nick__

    def GetUser(self):
        return __User__

    def GetRealName(self):
        return __RealName__

    def GetPass(self):
        return __Pass__

    def GetInfo(self):
        return __Info__
    # end getters

    # start misc functions
    def Connect(self): # connect to the host and test for errors
        try:
            self.__ServerSocket__ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.__ServerSocket__.connect((self.__Host__, self.__Port__))

        except socket.error, Message:
            print "Error " + str(Message[0]) +": " + Message[1]
            sys.exit();

        return

    def Join(self):
        return

    def GetNamesList(self):
        return

    def Send(self, Message):
        self.__ServerSocket__.send(Message)
        return

    def Recv(self, Bytes = 1024):
        return self.__ServerSocket__.recv(Bytes)

    def Close(self):
        self.__ServerSocket__.close()
        return

    def ParseCommand(self):
        return

    def StartSession(self):
        self.Send("NICK %s\r\n" % self.__Nick__)
        self.Send("USER %s %s bla :%s\r\n" % (self.__User__, self.__Host__, self.__RealName__))
        self.Send("JOIN :%s\r\n" % self.__Channel__)
        return
    # end misc functions

session = IRC()
session.Connect()
session.StartSession()
print session.Recv()
raw_input("$> ") # for pausing
session.Close()


and my output is now this:
NOTICE AUTH :*** Looking up your hostname
NOTICE AUTH :*** Checking Ident
PING :3643141246
NOTICE AUTH :*** Your forward and reverse DNS do not match, ignoring hostname.
:blacklotus.ca.us.quakenet.org 451 DTSCode-Bot DTSCode-Bot :Register first.

$>
Jan 1, 2014 at 12:28pm
@DTSCode You are not sending PONG responses: https://tools.ietf.org/html/rfc2812#section-3.7.3
Jan 1, 2014 at 7:55pm
closed account (Dy7SLyTq)
ok ill do that
Topic archived. No new replies allowed.