Add few other things in the struct
This commit is contained in:
parent
1c8ba22489
commit
d1fa763dee
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(
|
||||
uIRC
|
||||
VERSION 0.2.2
|
||||
VERSION 0.2.3
|
||||
DESCRIPTION "Simple and lightweight IRC protocol helper"
|
||||
LANGUAGES C
|
||||
)
|
||||
|
@ -35,6 +35,7 @@ set(UIRC_HEADERS
|
|||
src/types.h
|
||||
src/assemblers/assemblers.h
|
||||
src/tokenizers/tokenizers.h
|
||||
src/memory/memory.h
|
||||
)
|
||||
|
||||
# Libraries used
|
||||
|
|
|
@ -65,7 +65,7 @@ uirc_malloc_capability(const char* name)
|
|||
}
|
||||
|
||||
IRC_User*
|
||||
uirc_malloc_user(const char* nick, const char* user, const char* real)
|
||||
uirc_malloc_user(const char* nick, const char* user, const char* real, const char* host)
|
||||
{
|
||||
IRC_User* ret;
|
||||
if ((ret = malloc(sizeof(IRC_User))) != NULL) {
|
||||
|
@ -88,6 +88,12 @@ uirc_malloc_user(const char* nick, const char* user, const char* real)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
if (host != NULL) {
|
||||
if ((ret->host = malloc_string(host, strlen(host))) == NULL) {
|
||||
uirc_free_user(ret);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -150,7 +156,7 @@ uirc_malloc_buffer(const char* name, const char* topic, const char* key)
|
|||
}
|
||||
|
||||
IRC_Network*
|
||||
uirc_malloc_network(const char* addr, const char* svc)
|
||||
uirc_malloc_network(const char* addr, const char* svc, const char* pass, const char* quitmsg)
|
||||
{
|
||||
IRC_Network* ret;
|
||||
assert(addr != NULL);
|
||||
|
@ -165,6 +171,18 @@ uirc_malloc_network(const char* addr, const char* svc)
|
|||
uirc_free_network(ret);
|
||||
return NULL;
|
||||
}
|
||||
if (pass != NULL) {
|
||||
if ((ret->pass = malloc_string(pass, strlen(svc))) == NULL) {
|
||||
uirc_free_network(ret);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (quitmsg != NULL) {
|
||||
if ((ret->quitmsg = malloc_string(quitmsg, strlen(quitmsg))) == NULL) {
|
||||
uirc_free_network(ret);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -100,6 +100,8 @@ uirc_free_network(IRC_Network* n)
|
|||
|
||||
free(n->addr);
|
||||
free(n->svc);
|
||||
free(n->pass);
|
||||
free(n->quitmsg);
|
||||
|
||||
if (n->user != NULL) {
|
||||
uirc_free_user(n->user);
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
|
||||
IRC_Tag* uirc_malloc_tag(const char* key, const char* value);
|
||||
IRC_Capability* uirc_malloc_capability(const char* name);
|
||||
IRC_User* uirc_malloc_user(const char* nick, const char* user, const char* real);
|
||||
IRC_User* uirc_malloc_user(const char* nick, const char* user, const char* real, const char* host);
|
||||
IRC_Message* uirc_malloc_message(const char* command, ...);
|
||||
IRC_Buffer* uirc_malloc_buffer(const char* name, const char* topic, const char* key);
|
||||
IRC_Network* uirc_malloc_network(const char* addr, const char* svc);
|
||||
IRC_Network* uirc_malloc_network(const char* addr, const char* svc, const char* pass, const char* quitmsg);
|
||||
|
||||
void uirc_free_tag(IRC_Tag* t);
|
||||
void uirc_free_capability(IRC_Capability* c);
|
||||
|
|
|
@ -69,7 +69,7 @@ typedef struct {
|
|||
} IRC_Buffer;
|
||||
|
||||
typedef struct {
|
||||
char * addr, *svc;
|
||||
char * addr, *svc, *pass, *quitmsg;
|
||||
IRC_User* user;
|
||||
llist_t* buf_list;
|
||||
#ifdef UIRC_FEATURE_IRCV3
|
||||
|
|
Reference in New Issue