split IRC.c and moved it to a different repo
This commit is contained in:
48
src/irc/irc_userparams.c
Normal file
48
src/irc/irc_userparams.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "IRC/IRC.h"
|
||||
|
||||
void IRC_SetSASLParameters(irc_sasl_mechanism_t mechanism, char *username, char *password, irc_client_t *irc)
|
||||
{
|
||||
switch(mechanism)
|
||||
{
|
||||
case SASL_MECHANISM_NONE:
|
||||
break;
|
||||
case SASL_MECHANISM_EXTERNAL:
|
||||
// unimplemented
|
||||
break;
|
||||
case SASL_MECHANISM_PLAIN:
|
||||
irc->saslAuth.mechanism = mechanism;
|
||||
strncpy(irc->saslAuth.plain_credentials.username, username, sizeof(irc->saslAuth.plain_credentials.username) - 1);
|
||||
strncpy(irc->saslAuth.plain_credentials.password, password, sizeof(irc->saslAuth.plain_credentials.password) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void IRC_RequestSASLAuthentication(irc_client_t *irc)
|
||||
{
|
||||
switch(irc->saslAuth.mechanism)
|
||||
{
|
||||
case SASL_MECHANISM_NONE:
|
||||
// why?
|
||||
break;
|
||||
case SASL_MECHANISM_PLAIN:
|
||||
IRC_Send(irc, "AUTHENTICATE PLAIN\r\n");
|
||||
break;
|
||||
case SASL_MECHANISM_EXTERNAL:
|
||||
IRC_Send(irc, "AUTHENTICATE EXTERNAL\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void IRC_SetConnectionParameters(char *host, int port, irc_connection_type_t conntype, irc_client_t *irc)
|
||||
{
|
||||
snprintf(irc->connectionInfo.host, sizeof irc->connectionInfo.host, "%s", host);
|
||||
irc->connectionInfo.port = port;
|
||||
irc->connectionInfo.connType = conntype;
|
||||
}
|
||||
|
||||
void IRC_SetIdentityParameters(char *nickname, char *username, char *realname, irc_client_t *irc)
|
||||
{
|
||||
snprintf(irc->identity.nick, sizeof irc->identity.nick, "%s", nickname);
|
||||
snprintf(irc->identity.username, sizeof irc->identity.username, "%s", username);
|
||||
snprintf(irc->identity.realname, sizeof irc->identity.realname, "%s", realname);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user