Sat, 19 Aug 2006 01:50:10 +0000
[gaim-migrate @ 16863]
Renamed 'core' to 'libgaim'
| 8849 | 1 | /* |
| 2 | ||
| 3 | silcgaim.h | |
| 4 | ||
| 5 | Author: Pekka Riikonen <priikone@silcnet.org> | |
| 6 | ||
| 7 | Copyright (C) 2004 Pekka Riikonen | |
| 8 | ||
| 9 | This program is free software; you can redistribute it and/or modify | |
| 10 | it under the terms of the GNU General Public License as published by | |
| 11 | the Free Software Foundation; version 2 of the License. | |
| 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | GNU General Public License for more details. | |
| 17 | ||
| 18 | */ | |
| 19 | ||
| 20 | #ifndef SILCGAIM_H | |
| 21 | #define SILCGAIM_H | |
| 22 | ||
| 23 | /* Gaim includes */ | |
| 24 | #include "internal.h" | |
| 25 | #include "account.h" | |
| 26 | #include "accountopt.h" | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
27 | #include "cmds.h" |
|
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
28 | #include "conversation.h" |
| 8849 | 29 | #include "debug.h" |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
30 | #include "ft.h" |
| 8849 | 31 | #include "notify.h" |
| 32 | #include "prpl.h" | |
| 33 | #include "request.h" | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
34 | #include "roomlist.h" |
| 8849 | 35 | #include "server.h" |
| 36 | #include "util.h" | |
| 37 | ||
| 38 | /* Default public and private key file names */ | |
| 39 | #define SILCGAIM_PUBLIC_KEY_NAME "public_key.pub" | |
| 40 | #define SILCGAIM_PRIVATE_KEY_NAME "private_key.prv" | |
| 41 | ||
| 42 | /* Default settings for creating key pair */ | |
| 43 | #define SILCGAIM_DEF_PKCS "rsa" | |
| 44 | #define SILCGAIM_DEF_PKCS_LEN 2048 | |
| 45 | ||
| 46 | #define SILCGAIM_PRVGRP 0x001fffff | |
| 47 | ||
|
10050
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
48 | /* Status IDs */ |
|
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
49 | #define SILCGAIM_STATUS_ID_OFFLINE "offline" |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10341
diff
changeset
|
50 | #define SILCGAIM_STATUS_ID_AVAILABLE "available" |
|
10050
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
51 | #define SILCGAIM_STATUS_ID_HYPER "hyper" |
|
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
52 | #define SILCGAIM_STATUS_ID_AWAY "away" |
|
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
53 | #define SILCGAIM_STATUS_ID_BUSY "busy" |
|
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
54 | #define SILCGAIM_STATUS_ID_INDISPOSED "indisposed" |
|
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
55 | #define SILCGAIM_STATUS_ID_PAGE "page" |
|
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
56 | |
| 8849 | 57 | typedef struct { |
| 58 | unsigned long id; | |
| 59 | const char *channel; | |
| 60 | unsigned long chid; | |
| 61 | const char *parentch; | |
| 62 | SilcChannelPrivateKey key; | |
| 63 | } *SilcGaimPrvgrp; | |
| 64 | ||
| 65 | /* The SILC Gaim plugin context */ | |
| 66 | typedef struct SilcGaimStruct { | |
| 67 | SilcClient client; | |
| 68 | SilcClientConnection conn; | |
| 69 | ||
|
14179
b54c870fb9d0
[gaim-migrate @ 16751]
Mark Doliner <markdoliner@pidgin.im>
parents:
12970
diff
changeset
|
70 | GaimProxyConnectInfo *connect_info; |
| 8849 | 71 | guint scheduler; |
| 72 | GaimConnection *gc; | |
| 73 | GaimAccount *account; | |
| 74 | unsigned long channel_ids; | |
| 75 | GList *grps; | |
| 76 | ||
| 77 | char *motd; | |
| 78 | GaimRoomlist *roomlist; | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
79 | #ifdef HAVE_SILCMIME_H |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
80 | SilcMimeAssembler mimeass; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
81 | #endif |
| 8849 | 82 | unsigned int detaching : 1; |
| 83 | unsigned int resuming : 1; | |
| 84 | unsigned int roomlist_canceled : 1; | |
| 85 | unsigned int chpk : 1; | |
| 86 | } *SilcGaim; | |
| 87 | ||
| 88 | ||
| 89 | gboolean silcgaim_check_silc_dir(GaimConnection *gc); | |
| 90 | void silcgaim_chat_join_done(SilcClient client, | |
| 91 | SilcClientConnection conn, | |
| 92 | SilcClientEntry *clients, | |
| 93 | SilcUInt32 clients_count, | |
| 94 | void *context); | |
| 95 | const char *silcgaim_silcdir(void); | |
| 96 | const char *silcgaim_session_file(const char *account); | |
| 97 | void silcgaim_verify_public_key(SilcClient client, SilcClientConnection conn, | |
| 98 | const char *name, SilcSocketType conn_type, | |
| 99 | unsigned char *pk, SilcUInt32 pk_len, | |
| 100 | SilcSKEPKType pk_type, | |
| 101 | SilcVerifyPublicKey completion, void *context); | |
| 9038 | 102 | GList *silcgaim_buddy_menu(GaimBuddy *buddy); |
|
9288
a19f73556084
[gaim-migrate @ 10091]
Mark Doliner <markdoliner@pidgin.im>
parents:
9272
diff
changeset
|
103 | void silcgaim_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group); |
|
10869
86a3144baf08
[gaim-migrate @ 12556]
Mark Doliner <markdoliner@pidgin.im>
parents:
10801
diff
changeset
|
104 | void silcgaim_send_buddylist(GaimConnection *gc); |
|
9288
a19f73556084
[gaim-migrate @ 10091]
Mark Doliner <markdoliner@pidgin.im>
parents:
9272
diff
changeset
|
105 | void silcgaim_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group); |
| 8849 | 106 | void silcgaim_buddy_keyagr_request(SilcClient client, |
| 107 | SilcClientConnection conn, | |
| 108 | SilcClientEntry client_entry, | |
| 109 | const char *hostname, SilcUInt16 port); | |
| 110 | void silcgaim_idle_set(GaimConnection *gc, int idle); | |
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
111 | void silcgaim_tooltip_text(GaimBuddy *b, GString *str, gboolean full); |
| 8849 | 112 | char *silcgaim_status_text(GaimBuddy *b); |
| 113 | gboolean silcgaim_ip_is_private(const char *ip); | |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9353
diff
changeset
|
114 | void silcgaim_ftp_send_file(GaimConnection *gc, const char *name, const char *file); |
|
12149
9706e9a4fad3
[gaim-migrate @ 14450]
Richard Laager <rlaager@pidgin.im>
parents:
11522
diff
changeset
|
115 | GaimXfer *silcgaim_ftp_new_xfer(GaimConnection *gc, const char *name); |
| 8849 | 116 | void silcgaim_ftp_request(SilcClient client, SilcClientConnection conn, |
| 117 | SilcClientEntry client_entry, SilcUInt32 session_id, | |
| 118 | const char *hostname, SilcUInt16 port); | |
| 119 | void silcgaim_show_public_key(SilcGaim sg, | |
| 120 | const char *name, SilcPublicKey public_key, | |
| 121 | GCallback callback, void *context); | |
| 122 | void silcgaim_get_info(GaimConnection *gc, const char *who); | |
| 123 | SilcAttributePayload | |
| 124 | silcgaim_get_attr(SilcDList attrs, SilcAttribute attribute); | |
| 125 | void silcgaim_get_umode_string(SilcUInt32 mode, char *buf, | |
| 126 | SilcUInt32 buf_size); | |
| 127 | void silcgaim_get_chmode_string(SilcUInt32 mode, char *buf, | |
| 128 | SilcUInt32 buf_size); | |
| 129 | void silcgaim_get_chumode_string(SilcUInt32 mode, char *buf, | |
| 130 | SilcUInt32 buf_size); | |
| 131 | GList *silcgaim_chat_info(GaimConnection *gc); | |
| 9756 | 132 | GHashTable *silcgaim_chat_info_defaults(GaimConnection *gc, const char *chat_name); |
| 9038 | 133 | GList *silcgaim_chat_menu(GaimChat *); |
| 8849 | 134 | void silcgaim_chat_join(GaimConnection *gc, GHashTable *data); |
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9756
diff
changeset
|
135 | char *silcgaim_get_chat_name(GHashTable *data); |
| 8849 | 136 | void silcgaim_chat_invite(GaimConnection *gc, int id, const char *msg, |
| 137 | const char *name); | |
| 138 | void silcgaim_chat_leave(GaimConnection *gc, int id); | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
139 | int silcgaim_chat_send(GaimConnection *gc, int id, const char *msg, GaimMessageFlags flags); |
| 8849 | 140 | void silcgaim_chat_set_topic(GaimConnection *gc, int id, const char *topic); |
| 141 | GaimRoomlist *silcgaim_roomlist_get_list(GaimConnection *gc); | |
| 142 | void silcgaim_roomlist_cancel(GaimRoomlist *list); | |
| 143 | void silcgaim_chat_chauth_show(SilcGaim sg, SilcChannelEntry channel, | |
| 144 | SilcBuffer channel_pubkeys); | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
145 | void silcgaim_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
146 | char **contactstr, char **langstr, char **devicestr, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
147 | char **tzstr, char **geostr); |
|
12761
f9b56ebfe562
[gaim-migrate @ 15108]
Pekka Riikonen <priikone@silcnet.org>
parents:
12323
diff
changeset
|
148 | #ifdef SILC_ATTRIBUTE_USER_ICON |
|
f9b56ebfe562
[gaim-migrate @ 15108]
Pekka Riikonen <priikone@silcnet.org>
parents:
12323
diff
changeset
|
149 | void silcgaim_buddy_set_icon(GaimConnection *gc, const char *iconfile); |
|
f9b56ebfe562
[gaim-migrate @ 15108]
Pekka Riikonen <priikone@silcnet.org>
parents:
12323
diff
changeset
|
150 | #endif |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
151 | #ifdef HAVE_SILCMIME_H |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
152 | char *silcgaim_file2mime(const char *filename); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
153 | SilcDList silcgaim_image_message(const char *msg, SilcUInt32 *mflags); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
154 | #endif |
| 8849 | 155 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
156 | #ifdef _WIN32 |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
157 | typedef int uid_t; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
158 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
159 | struct passwd { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
160 | char *pw_name; /* user name */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
161 | char *pw_passwd; /* user password */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
162 | int pw_uid; /* user id */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
163 | int pw_gid; /* group id */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
164 | char *pw_gecos; /* real name */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
165 | char *pw_dir; /* home directory */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
166 | char *pw_shell; /* shell program */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
167 | }; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
168 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
169 | struct passwd *getpwuid(int uid); |
|
12323
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
12217
diff
changeset
|
170 | int getuid(void); |
|
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
12217
diff
changeset
|
171 | int geteuid(void); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
172 | #endif |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
173 | |
| 8849 | 174 | #endif /* SILCGAIM_H */ |