* This code is licensed under the GPL v2. See the file COPYING in this
* directory for the full license text.
*
- * $Id: auth.c 4258 2006-01-29 13:34:44 +0000 (Sun, 29 Jan 2006) dothebart $
+ * $Id:citadel.c 4326 2006-02-18 12:26:22Z hjalfi $
*/
#define GAIM_PLUGINS
#define VERSION "0.2"
#define CITADEL_DEFAULT_SERVER "uncensored.citadel.org"
#define CITADEL_DEFAULT_PORT 504
-#define CITADEL_POLL_INTERVAL 10
+#define CITADEL_POLL_INTERVAL 60
#define LUA_MICROCODE "/plugindata/citadel.lua"
struct citadel {
option = gaim_account_option_int_new(_("Port"), "port", CITADEL_DEFAULT_PORT);
protocol.protocol_options = g_list_append(protocol.protocol_options, option);
+ option = gaim_account_option_bool_new(_("Everyone here's a buddy"), "no_blist", TRUE);
+ protocol.protocol_options = g_list_append(protocol.protocol_options, option);
+
option = gaim_account_option_bool_new(_("Use TLS"), "use_tls", TRUE);
protocol.protocol_options = g_list_append(protocol.protocol_options, option);
-- This code is licensed under the GPL v2. See the file COPYING in this
-- directory for the full license text.
--
--- $Id: auth.c 4258 2006-01-29 13:34:44 +0000 (Sun, 29 Jan 2006) dothebart $
+-- $Id:citadel.lua 4326 2006-02-18 12:26:22Z hjalfi $
-----------------------------------------------------------------------------
-- GLOBALS --
local ga, gc
local fd, gsc
local timerhandle
+local noblist
local buddies = {}
-----------------------------------------------------------------------------
local CITADEL_DEFAULT_PORT = 504
local CITADEL_CONFIG_ROOM = "My Citadel Config"
+local WAITING_ROOM = "Sent/Received Pages"
local CITADEL_BUDDY_MSG = "__ Buddy List __"
-local CITADEL_POLL_INTERVAL = 5
+local CITADEL_POLL_INTERVAL = 60
-----------------------------------------------------------------------------
-- UTILITIES --
for _, i in ipairs(arg) do
table.insert(s, tostring(i))
end
- print("citadel: lua: "..table.concat(s))
+ s = table.concat(s)
+ gaim_debug_info("citadel", (string.gsub(s, "%%", "%%")))
end
local function unexpectederror()
end
local function save_buddy_list()
- writeline("GOTO "..CITADEL_CONFIG_ROOM)
+ writeline("GOTO "..CITADEL_CONFIG_ROOM.."||1")
local m = get_response()
if (m.response ~= CIT_OK) then
cant_save_buddy_list()
-- Go back to the lobby.
- writeline("GOTO _BASEROOM_")
+ writeline("GOTO "..WAITING_ROOM)
get_response()
end
local onlinebuddies = {}
for _, s in ipairs(m.xargs) do
local name = unpack_citadel_data_line(s)[2]
- onlinebuddies[name] = true
+ if (name ~= "(not logged in)") then
+ onlinebuddies[name] = true
+ end
+ end
+
+ -- Anyone who's not online is offline.
+
+ for s, _ in pairs(buddies) do
+ if not onlinebuddies[s] then
+ serv_got_update(gc, s, false, 0, 0, 0, 0)
+ end
end
+ -- Anyone who's online is, er, online.
+
for s, _ in pairs(onlinebuddies) do
+ -- If we're in no-buddy-list mode and this buddy isn't on our
+ -- list, add them automatically.
+
+ if noblist then
+ if not gaim_find_buddy(ga, s) then
+ local buddy = gaim_buddy_new(ga, s, s)
+ local group = gaim_group_new("Citadel")
+ if buddy then
+ -- buddy is not garbage collected! This must succeed!
+ gaim_blist_add_buddy(buddy, nil, group, nil)
+ end
+ end
+ end
+
serv_got_update(gc, s, true, 0, 0, 0, 0)
end
end
username = gaim_account_get_username(ga)
_, _, username, servername = string.find(username, "^(.*)@(.*)$")
- port = gaim_account_get_int(ga, "port", CITADEL_DEFAULT_PORT);
+ port = gaim_account_get_int(ga, "port", CITADEL_DEFAULT_PORT)
+ noblist = gaim_account_get_bool(ga, "no_blist", false)
log("connect to ", username, " on server ", servername, " port ", port)
-- Switch to private configuration room.
gaim_connection_update_progress(gc, "Setting up", 8, STEPS)
- writeline("GOTO "..CITADEL_CONFIG_ROOM)
+ writeline("GOTO "..CITADEL_CONFIG_ROOM.."||1")
m = get_response()
if (m.response ~= CIT_OK) then
warning("Unable to fetch buddy list from server.")
-- Go back to the Lobby.
gaim_connection_update_progress(gc, "Setting up", 12, STEPS)
- writeline("GOTO _BASEROOM_")
+ writeline("GOTO "..WAITING_ROOM)
get_response()
-- Switch on the timer.
end)
end
-function citadel_keepalive()
- queue(function()
- writeline("NOOP")
- get_response()
- end)
-end
-
-----------------------------------------------------------------------------
-- BUDDY LIST --
-----------------------------------------------------------------------------
* This code is licensed under the GPL v2. See the file COPYING in this
* directory for the full license text.
*
- * $Id: auth.c 4258 2006-01-29 13:34:44 +0000 (Sun, 29 Jan 2006) dothebart $
+ * $Id:gaim.pkg 4326 2006-02-18 12:26:22Z hjalfi $
*/
typedef unsigned int size_t;
$#include "server.h"
$#include "notify.h"
$#include "util.h"
+$#include "debug.h"
$#include "interface.h"
const char *gaim_normalize(const GaimAccount *account, const char *str);
const char *gaim_normalize_nocase(const GaimAccount *account, const char *str);
+
+/* --- debug.h ----------------------------------------------------------- */
+
+typedef enum
+{
+ GAIM_DEBUG_ALL = 0, /**< All debug levels. */
+ GAIM_DEBUG_MISC, /**< General chatter. */
+ GAIM_DEBUG_INFO, /**< General operation Information. */
+ GAIM_DEBUG_WARNING, /**< Warnings. */
+ GAIM_DEBUG_ERROR, /**< Errors. */
+ GAIM_DEBUG_FATAL /**< Fatal errors. */
+
+} GaimDebugLevel;
+
+void gaim_debug(GaimDebugLevel level, const char *category,
+ const char *format);
+void gaim_debug_misc(const char *category, const char *format);
+void gaim_debug_info(const char *category, const char *format);
+void gaim_debug_warning(const char *category, const char *format);
+void gaim_debug_error(const char *category, const char *format);
+void gaim_debug_fatal(const char *category, const char *format);
+