-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for queries, add subcommand history
- Loading branch information
Showing
15 changed files
with
642 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
#include "common.h" | ||
#include "rocketchat.h" | ||
|
||
typedef struct { | ||
char *rid; | ||
} MODULE_QUERY_REC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef __ROCKETCHAT_CHANNELS_H | ||
#define __ROCKETCHAT_CHANNELS_H | ||
|
||
#include "channels.h" | ||
|
||
#define ROCKETCHAT_CHANNEL(channel) \ | ||
PROTO_CHECK_CAST(CHANNEL(channel), CHANNEL_REC, chat_type, "rocketchat") | ||
|
||
#define IS_ROCKETCHAT_CHANNEL(channel) \ | ||
(ROCKETCHAT_CHANNEL(channel) ? TRUE : FALSE) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "module.h" | ||
#include "modules.h" | ||
#include "rocketchat-queries.h" | ||
|
||
const char * | ||
rocketchat_query_get_rid(ROCKETCHAT_QUERY_REC *query) | ||
{ | ||
MODULE_QUERY_REC * module_query; | ||
|
||
module_query = MODULE_DATA(query); | ||
|
||
return module_query->rid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
#ifndef __ROCKETCHAT_QUERIES_H | ||
#define __ROCKETCHAT_QUERIES_H | ||
|
||
#include "queries.h" | ||
#include "rocketchat-servers.h" | ||
|
||
#define ROCKETCHAT_QUERY(query) \ | ||
PROTO_CHECK_CAST(QUERY(query), ROCKETCHAT_QUERY_REC, chat_type, "rocketchat") | ||
|
||
#define IS_ROCKETCHAT_QUERY(query) \ | ||
(ROCKETCHAT_QUERY(query) ? TRUE : FALSE) | ||
|
||
#define STRUCT_SERVER_REC ROCKETCHAT_SERVER_REC | ||
struct _ROCKETCHAT_QUERY_REC { | ||
#include "query-rec.h" | ||
}; | ||
|
||
const char * rocketchat_query_get_rid(ROCKETCHAT_QUERY_REC *query); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2020 Julian Maurice | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#include "module.h" | ||
#include "rocketchat.h" | ||
#include "rocketchat-room.h" | ||
|
||
ROCKETCHAT_ROOM_REC *rocketchat_room_new(const char *id, char type, const char *name, const char *fname) | ||
{ | ||
ROCKETCHAT_ROOM_REC *room; | ||
|
||
room = g_new0(ROCKETCHAT_ROOM_REC, 1); | ||
room->id = g_strdup(id); | ||
room->type = type; | ||
if (name) { | ||
room->name = g_strdup(name); | ||
} | ||
if (fname) { | ||
room->fname = g_strdup(fname); | ||
} | ||
|
||
return room; | ||
} | ||
|
||
void rocketchat_room_free(ROCKETCHAT_ROOM_REC *room) | ||
{ | ||
if (room) { | ||
g_free(room->id); | ||
g_free(room->name); | ||
g_free(room->fname); | ||
g_free(room); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef __ROCKETCHAT_ROOM_H | ||
#define __ROCKETCHAT_ROOM_H | ||
|
||
#include "rocketchat.h" | ||
|
||
struct _ROCKETCHAT_ROOM_REC { | ||
char *id; | ||
char type; | ||
char *name; | ||
char *fname; | ||
}; | ||
|
||
ROCKETCHAT_ROOM_REC *rocketchat_room_new(const char *id, char type, const char *name, const char *fname); | ||
void rocketchat_room_free(ROCKETCHAT_ROOM_REC *room); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.