aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/unknown.c
blob: 105b2f62f2cf58249791c607251fbf4e66ec05b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/********************************************************************\
  * BitlBee -- An IRC to other IM-networks gateway                     *
  *                                                                    *
  * Copyright 2002-2016 Wilmer van der Gaast and others                *
  \********************************************************************/

/*
  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 with
  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
  if not, write to the Free Software Foundation, Inc., 51 Franklin St.,
  Fifth Floor, Boston, MA  02110-1301  USA
*/

#define BITLBEE_CORE
#include "nogaim.h"

/* Displays an error when trying to connect this account */
static void unknown_prpl_login(account_t *acc)
{
	struct im_connection *ic = imcb_new(acc);
	char *msg;

	imcb_error(ic, "Unknown protocol");

	msg = explain_unknown_protocol(acc->prpl->name);
	imcb_error(ic, "%s", msg);
	g_free(msg);

	imc_logout(ic, FALSE);
}

/* Required, no-op */
static void unknown_prpl_logout(struct im_connection *ic)
{
}

/* Needed to ensure the server setting is preserved */
static void unknown_prpl_init(account_t *acc)
{
	set_t *s;

	s = set_add(&acc->set, "server", NULL, set_eval_account, acc);
	s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY | SET_NULL_OK;
}

/* Needed to silence warnings about named groupchats not supported */
struct groupchat *unknown_prpl_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password,
                                         set_t **sets)
{
	return NULL;
}

void unknown_prpl_initmodule(struct prpl **prpl)
{
	struct prpl *ret = g_new0(struct prpl, 1);

	ret->name = "unknown";
	ret->options = PRPL_OPT_UNKNOWN_PROTOCOL | PRPL_OPT_NOOTR;
	ret->login = unknown_prpl_login;
	ret->logout = unknown_prpl_logout;
	ret->init = unknown_prpl_init;
	ret->chat_join = unknown_prpl_chat_join;
	*prpl = ret;
}