Coder Social home page Coder Social logo

dalexhd / ft_irc Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 82.23 MB

The goal of this project is to make you write your own IRC server. To do so, you will test your work with a real IRC client. Internet is ruled by solid and standards protocols that allow a strong interaction between every connected computer. It’s always good to know about it.

Home Page: https://irc.dalexhd.dev

Shell 41.24% Dockerfile 0.49% Makefile 5.13% C++ 53.14%
cpp cpp98 irc irc-server

ft_irc's Introduction

Hey 👋🏽, I'm DalexHD


DalexHD's Discord DalexHD's Twitter DalexHD's LinkdeIN DalexHD's Telegram DalexHD's Instagram DalexHD's Reddit


Hi, I'm DalexHD, a Full Stack Developer 🚀 from Spain, currently, I'm a 42's school student who loves new JavaScript related technologies.

GIF

Talking about Personal Stuffs:

  • 👨🏽‍💻 I’m currently working at Softpoint;
  • 👨‍🎓 I’m currently studying Computer Science at 42 school;
  • 🌱 I’m currently learning C;
  • ⌨️ I love spaces and tabs;
  • 💬 Ask me about anything, I am happy to help;
  • 📫 How to reach me: [email protected];

Languages and Tools I've used:

Hosting/SaaS

Programming Languages

TypeScript

Databases

MongoDB

Frameworks

Express.js Bootstrap NuxtJS Next JS Laravel jQuery

Other Tools

Spotify Trello Arduino

Personal quote

Programming is not just for coding, it also changes your way of thinking when tackling problems or challenges in your life.


Visitor count

ft_irc's People

Contributors

dalexhd avatar evil-a avatar marc459 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

marc459

ft_irc's Issues

Kick command needs a specific is_ope logic.

Remove is_ope from the command properties. In case the command is something like "kick alex" you'll need ope rights. But if it is "kick #testchannel alex" you will need to be operator of that specific channel. This means that this command instead of using generic "is_ope" property, it will use a specific logic.

SEGV:

when client "list inexistingchannel" and then "list"

Add socket listener

Currently, we are able to listen sockets. But we are missing the code at run method. This will allow us to be able to relate events with the core backend.

Server::Server(char *port, char *password) : status(1)
{
	int opt;

	// Socket specific vars/options
	if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
		throw std::runtime_error("socket() failed" + std::string(strerror(errno)));
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1)
		throw std::runtime_error("setsockopt() failed" + std::string(strerror(errno)));

	address.sin_family = AF_INET;
	address.sin_port = htons(std::atoi(port));
	address.sin_addr.s_addr = INADDR_ANY;

	// First we need to bind the socket to a port. If there is an error, we will throw an exception.
	if (bind(fd, (struct sockaddr *) &address, sizeof(address)) == -1)
		throw std::runtime_error("bind() failed " + std::string(strerror(errno)));
	// Now we need to listen for connections. Maxiumum of 3 connections.
	if (listen(fd, 3) == -1)
		throw std::runtime_error("listen() failed " + std::string(strerror(errno)));

	std::cout << "Server started at port " << port << " with password: " << password << std::endl
	          << "Waiting for incomming connections..." << std::endl;
}

Client's joined channels should be accessible within client's class.

🚀 Feature

Client's joined channels should be accessible within client's class.

Motivation

In order to send a Quit notification, it must only be sent to those channels and clients that are related with the client that executes that Quit notification.
Now it sends that notification to all clients within the server, without making distinguishing if a relation exists or not.

Possible Implementation

Currently, channels contains an array of clients. In case we want clients to also contain an array of channels where he is in, we need to implement a solution in order to prevent a Circular dependency issue.

@rnavarre42 proposed me to have an array of pointers instead of an array of clients. So this problem should disappear.

Question I've related to this proposal.

  1. How are we able to access client->channels[0]->name if channels aka channels[0] is not typed by a hpp header, but is typed with a pointer. Is it done by casting the pointer value, maybe?¿

  2. How do we prevent infinite loop of client->channels[0]->clients[0]->channels[0]->clients[0]->channels[0]->clients[0]...?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.