ft_irc's People
ft_irc's Issues
Create MessageHandler
Attributes:
- Prefix
- Command
- Parameters
NOTE: Setters and Getters are needed.
Receives string from Socket and Splits it into a string vector.
Sent to Interpreter the vector.
Implement Private Message
- User must be able to Send and Receive private Messages
- Message Parsing (NO HARDCODE)
MultiClient Server
#Make the Server able to have more than one client at a time.
RUN 2 WEECHAT: weechat --dir <dir>
- Study the poll() function (or select(), kqueue(), or epoll() )
- Implement the poll() funtion or equivalent
- Remake the structure of Socket and Server Class. Check what variables and methods are being used or not
Implement Private and Secret Channel on Server Side
I don't think it will be needed ....
Explanation -> https://www.ircnet.com/articles/difference-between-channel-mode-secret-and-private
Operator PART
Succession of parted channel operator
Create Client Class
Attributes:
- Nickname
- Username
- Hostname
- Realname
- Password
NOTE:
Setters and Getters are needed.
This info comes from the /connection command and passed through the constructor
Interpreter Method
Server's method
void interpreter(std::string &msg);
- Check the Command
- Create new Client
- JOIN new Channel
- Send Message to Channel
OUTPUT:
127.0.0.1 connected on 51684
Received: PASS olaines
Received: CAP LS 302
Received: NICK isousa
Received: USER isousa 0 * :isousa
Received: PING 127.0.0.1
INPUT PASS: /server add socket 127.0.0.1/54000 -password=AInesELinda
Add Channel Vector to ClientClass
Each Client should have a vector of channels.
- JOIN = adds channel to the Vector
- APART (??) = deletes the channel from the Vector
Implement NOTICE
Implement Argc && Argv
Main Arguments must be implemented.
- Argv[1] = PORT
- Argv[2] = PASSWORD
- Error Handling ( argc < 0 && argc > 3 )
NOTE: This must be valid for the rest of the code. NO HARDCODE.
Create Channel Class
Attributes:
- Name
- Channel Operator (User * chop)
- Users ||
Tasks:
- Name and CHOP are received as parameter
- Create Setters and Getters
Implement Soft Exit (Turn off) for Server
Server is currently being turned off using ^C.
Killing the Process is not a good way to Turn it off.
We can use the signal() to Handle this.
001 RPL_WELCOME
Implement the RPL_WELCOME
- After receiving the NICK and USER message from the Client
- Send RPL_WELCOME to the Client
Text:
"001 RPL_WELCOME
"Welcome to the Internet Relay Network
nick!user@host "
Create Interpreter Class
Attributes:
- Message to be parsed
Tasks:
- Method to Create User
- Method to Delete User
- Method to Create Channel
- Method to Delete Channel
- Method to Send Message
NOTE:
This Class will handle parsing and logic.
Set Username and Nickname
User must be able to change his Nickname and Username after connection is done.
TESTING
- SEGFAULT: Delete channel after part, disconnect and join to that channel again (??)
JOIN
- Verify # (if needed and when)
If there is no '#' it should throw the ERR_NOSUCHCHANNEL
- Enter different channel at once (creating or already existing)
- Enter same channel multiple times
- Join without channel and with # only
- Join with invalid channel name
- Join with people in the Channel already
- Join several channels: created channels, new channels, invalid name channels, already a channel member
- Test limited users on channel
- Test to join without invitation (and with invitation)
- Test to join after being banned
- Test to join after being kicked
- Send topic when there is no topic (??)
PART
- Invalid channel name and channel that don't exist
- Leave channel #b from buffer #b
- Leave channel #b from buffer #a
- Leave channel #b from buffer #socket
- Multiple channels at the same time and in the conditions above
- Leave without being in the channel
- Leave channel after being banned
- ERR's
MODE
- Test with Op privileges and without
- Test with invalid mode command (wrong flags, no params, less params, more params, try with +, - and other symbols ... )
- Test outside channel buffer
- Test inside different channel buffer
- Composed flags
- More than 1 flag
Flag 'o'
- Give privileges to someone
- Remove privileges from someone
- Give to op's, remove from not op's
- Give privileges to not existing users
- Give privileges to users that are not in the channel
- Give / Remove to Multiple users (to all conditions above) --> *THIS IS NOT POSSIBLE IN LIBERA (ERR_NOSUCHNICK)
- Self set/unset
Flag 'p' && 's'
- Check set when not op
- Check set when not op (after not being op anymore)
- Turn true when false, and turn false when true
- Turn true when true, and turn false when false
Flag 'i'
At the moment, when inviting, it returns the error ERR_NOSUCHCHANNEL if the channel do not exist (just like libera). But the documentation says: "There is no requirement that the channel the target user is being invited to must exist or be a valid channel" and this error is not in the list of replies for the invite message. What do we do ??
- Invite someone
- Invite invited users
- Invite someone that does not exist
- Invite users that are in the channel
- Invite / Uninvite to Multiple users (to all conditions above) --> NOT POSSIBLE
- Test outside channel buffer
- Self invite (ERR_ALREADYONCHANNEL)
- Invite same user to multiple channels
Flag 't' // TOPIC
- Set topic by operator
- Ask for topic (operator and regular users)
- Set topic by regular user returns error
- Change topic to another
- With flag 't' set to true, only op's should be able to set topic
- With flag 't' set to false, anyone can set the topic
- Set topic without being on the channel (ERR_NOTONCHANNEL)
- Request topic without being on the channel (ERR_NOTONCHANNEL)
Flag 'n'
- Send without/with permission
Flag 'm'
- Set and Unset
- Set and Unset outside the channel buffer
- Test CHOP privileges
- Test with Channel that doesnt exist
- Test with 'v' flag
- Test with PRIVMSG
Flag 'l'
- Set/unset
- Test with JOIN
- Test what happens if limited is inferior to the number of users already in the channel
Flag 'b'
- Ban/unban
- Ban/unban with motive
- What happens when ban without kick
- Ban users outside channel
- Ban non-existing users
- Ban banned users
- Ban operator
- Several users
- Self ban
Flag 'v'
Error with permissions ... Saying that a chop cant set the flag because is not CHOP
- Let someone speak
- Remove privileges from someone
- Give to op's, remove from not op's
- Give privileges to not existing users
- Give privileges to users that are not in the channel
- Give / Remove to Multiple users (to all conditions above)
- Self !!
Flag 'k'
- Set/unset
- Test
- Test with JOIN
KICK
- Kick
- Kick with motive
- Kick users outside channel
- Kick non-existing users
- Kick banned users
- Kick operator
- Self kick
QUIT
- /Disconnect
- /Quit
- Inside server/pirvmsg/channel buffers
- Arguments
- disconnect with many active channels and messages
PRIVMSG
- To user/channel
- To non-exiting users/channels
- To several users/channels
- Empty message
- Wrong arguments
- Different buffers
- Messages are getting cut by the space
NICK
- Set/unset
- Wrong arguments
- Wrong nicks -> can't have ',' or '.'
- Nicks in use
PASS
- Test
OPER
- Become oper
- Verify if it's possible to stop having privileges
- Take privileges
- Become oper twice
- Set username and password (Verify if it's possible)
KILL
- Kill
- Kill with motive
- Kill non-existing users
- Kill opers
- Kick killed users
- Kill operator
- Kill several users
- Self kill
EXIT
- Cntrl + c exit
Create ChannelsHandler
Attributes:
-
std::vector<Channel *> _channels;
-
Receive string and parse it
-
Add Channel to Vector (If channel do not exist, the user will be the CHOP)
-
Delete Channel From Vector (Only when there are no users left)
NOTE:
This Class is responsible for all the parsing and functions related to the channels.
Send Messages in Channel
A Message sent to a Channel must be forwarded to all Users in that Channel.
Create Exceptions
Replace the exit() function by Exceptions.
- Socket Class
- Channel Handler addChannel() && rmvClient()
- Client addChannel() && rmvChannel
Implement Server Operator
- OPER Command
- KILL Command
Search && Implement Error and Reply Returns
Change Socket Functions
This functions need to be replaced for the ones authorized in the Subject:
- memset()
- getnameinfo()
- inet_ntop()
- inet_pton()
NOTE: In Socket Class.
Create Socket
Attributes:
- Port
Tasks:
- Create the Socket Class
- Connect to the Client
- Read the Client's Message through the Socket
- Save the Message in a String
- Receive Port number through Constructor
Note:
This will be a Composition in Server Class.
Create Operators
Check '/r/n' in End of Messages
Operator Commands effect on Server
Update Vectors and Server state after using OP Commands
Create Server Class
Attributes:
- Port (Argv[1])
- Password (Argv[2])
- Socket (Composition)
- Interpreter (Composition)
Tasks:
- Constructor Receives Port and Password
- Password validation when Client Connection is received
- Redirect info to Client Handler
NOTE:
Password should be validated with the one in the Client class. If Password is not right, the Server can't accept the connection.
Port will be passed as parameter in the construction of the Socket Class.
Interpreter class will handle the logic decisions (Create User, create Channel, send Message etc)
Implement PART message
Create Client Handler
Attributes:
-
std::vector<Client *> _clients;
-
Receive string and parse it
-
Add Client to Vector
-
Delete client From Vector
NOTE:
This Class is responsible for all the parsing and functions related to the client.
Documentation for Socket Class
Create Documentation for the Socket Class: functions and how it works.
All the info is in the first commits of Socket Class Creation.
Verifications
-
Next Nickname on list search On login
-
Quit message on channels
-
Messages from outside to channels (-n)
-
PingPong
-
Username and Nickname differentiating
-
Multiple part - NOT POSSIBLE.
-
Multiple kick - NOT POSSIBLE.
-
Multiple invite - POSSIBLE (ex: /invite isousa1 isousa2 isousa3)
-
Seg fault when multiple clients disconnect at the same time by waiting
-
If users disconnect groups erase group
-
TOPIC ERR
-
If joining a channel that has no chops don't get chop privs
-
Invite ERR
-
Kick does not ban
-
Invite command is only for operators, channel must exist
-
Part command does not name another chop
-
NC
-
Memory issues
-
PRIVMSG ERR
-
001 and Nick differentiation
-
Nick ERR
-
When user disconnect take it off vectors
-
Change nickname on channel and PRIVMSG when nick is changed
-
Repeated nickname on server
-
Muted
-
Invited {Invited Vector}
-
Ban
-
rfc - MODE flags
- +m
- +n
- [ ]
- +v
- [ ] Several users - +b
- [ ] Several users - +i
- +t
- +o
- [ ] Several users - Several flags at the same time
-
Vector search existence
Makefile
Create Makefile with:
- $(NAME);
- fclean;
- clean;
- all;
- re;
Code Review and Cleaning
Operator Commands
Implement:
- KICK
Used by Channel Operators to Kick another Client from that Channel.
- MODE
It allows Channel Operators to change the characteristics of a Channel.
- INVITE
Allows Channel Operators to invite a client to an invite-only channel (mode +i)
- TOPIC
Allows Channel Operators to change the channel topic in a mode +t channel
- KILL
Allows operator to Kill a Connection between a Client and a Server.
Other commands needed for CHOP's:
- /op
- /halfop
- /dehalfop
- /deop
- oper
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.