Git Product home page Git Product logo

c-messaging-service's Introduction

C-messaging-service

A DM service using C programming with mySQL as middleware.

Working:

  • A user logs as a new/existing user. user-Info is compared against the one in DB to authenticate.
  • The user is presented with these options on successfull login,(else:error is reported):
    • Sending message.
    • Reading received messages.
    • Sign out
  • sendMessage/viewMessages function, communicate with the mySQL server to send/retrieve messages.
  • The afore options mentioned options are presented to the user, until they decide to logOut.
  • No Encryption/Decryption as it is centralised.

Building the .c file:

  • gcc -o <o/pfileName> $(mysql_config --cflags) kindaWorking.c $(mysql_config --libs)

O/P:

SS of exec

Schema for Databases:

create table users( id INT auto_increment primary key, name varchar(20) not null, password varchar(20) not null);

create table messages( id INT auto_increment primary key, uid INT, message varchar(255), foreign key(uid) references users(id) );

Index for functions:

  • finish_with_error(MYSQL *conn): reports the error-number(SQL) and exits, abruptly.(dev-only)
  • setState(char *name,int isActive):updates the currentUser structure.
  • createUser(MYSQL *conn, char *name, char *password):adds a new record to the users-table.
  • loginUser(MYSQL *conn, char *name, char *password): checks if the user-input name and password matches with that in DB.
  • sendMessage(MYSQL *conn): inserts a message record to the messages table with the user-input-content.
  • viewMessages(MYSQL *conn): reads messages from the message-table, of the current-user.
  • printOptions(): prints the options: send, view, and sign-out for receiving user input.
  • onLogin(): contains the calls to sendMessage() and viewMessage.

c-messaging-service's People

Contributors

ankur-datta-4 avatar

Stargazers

 avatar

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.