Mercurial > pidgin
comparison src/protocols/silc/silc.c @ 9359:43741d8f76f7
[gaim-migrate @ 10167]
More patches from Stu on patch 975859 -- this one adds back lost commands
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Wed, 23 Jun 2004 16:58:22 +0000 |
parents | b8138f3959dc |
children | d27156c9c876 |
comparison
equal
deleted
inserted
replaced
9358:5a9155e564d6 | 9359:43741d8f76f7 |
---|---|
881 return 0; | 881 return 0; |
882 mflags |= SILC_MESSAGE_FLAG_ACTION; | 882 mflags |= SILC_MESSAGE_FLAG_ACTION; |
883 } else if (strlen(msg) > 1 && msg[0] == '/') { | 883 } else if (strlen(msg) > 1 && msg[0] == '/') { |
884 if (!silc_client_command_call(client, conn, msg + 1)) | 884 if (!silc_client_command_call(client, conn, msg + 1)) |
885 gaim_notify_error(gc, ("Call Command"), _("Cannot call command"), | 885 gaim_notify_error(gc, ("Call Command"), _("Cannot call command"), |
886 _("Unknown command")); | 886 _("Unknown command")); |
887 return 0; | 887 return 0; |
888 } | 888 } |
889 | 889 |
890 | 890 |
891 if (!silc_parse_userfqdn(who, &nickname, NULL)) | 891 if (!silc_parse_userfqdn(who, &nickname, NULL)) |
1028 silcgaim_get_info(gc, args[0]); | 1028 silcgaim_get_info(gc, args[0]); |
1029 | 1029 |
1030 return GAIM_CMD_RET_OK; | 1030 return GAIM_CMD_RET_OK; |
1031 } | 1031 } |
1032 | 1032 |
1033 static GaimCmdRet silcgaim_cmd_chat_invite(GaimConversation *conv, | |
1034 const char *cmd, char **args, char **error) | |
1035 { | |
1036 int id; | |
1037 GaimConnection *gc; | |
1038 | |
1039 id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)); | |
1040 gc = gaim_conversation_get_gc(conv); | |
1041 | |
1042 if (gc == NULL) | |
1043 return GAIM_CMD_RET_FAILED; | |
1044 | |
1045 silcgaim_chat_invite(gc, id, NULL, args[0]); | |
1046 | |
1047 return GAIM_CMD_RET_OK; | |
1048 } | |
1049 | |
1050 static GaimCmdRet silcgaim_cmd_msg(GaimConversation *conv, | 1033 static GaimCmdRet silcgaim_cmd_msg(GaimConversation *conv, |
1051 const char *cmd, char **args, char **error) | 1034 const char *cmd, char **args, char **error) |
1052 { | 1035 { |
1053 int ret; | 1036 int ret; |
1054 GaimConnection *gc; | 1037 GaimConnection *gc; |
1171 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { | 1154 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { |
1172 g_free(silccmd); | 1155 g_free(silccmd); |
1173 return GAIM_CMD_RET_FAILED; | 1156 return GAIM_CMD_RET_FAILED; |
1174 } | 1157 } |
1175 g_free(silccmd); | 1158 g_free(silccmd); |
1159 | |
1160 return GAIM_CMD_RET_OK; | |
1161 } | |
1162 | |
1163 static GaimCmdRet silcgaim_cmd_quit(GaimConversation *conv, | |
1164 const char *cmd, char **args, char **error) | |
1165 { | |
1166 GaimConnection *gc; | |
1167 SilcGaim sg; | |
1168 | |
1169 gc = gaim_conversation_get_gc(conv); | |
1170 | |
1171 if (gc == NULL) | |
1172 return GAIM_CMD_RET_FAILED; | |
1173 | |
1174 sg = gc->proto_data; | |
1175 | |
1176 if (sg == NULL) | |
1177 return GAIM_CMD_RET_FAILED; | |
1178 | |
1179 silc_client_command_call(sg->client, sg->conn, NULL, | |
1180 "QUIT", (args && args[0]) ? args[0] : "Download Gaim: " GAIM_WEBSITE, NULL); | |
1181 | |
1182 return GAIM_CMD_RET_OK; | |
1183 } | |
1184 | |
1185 static GaimCmdRet silcgaim_cmd_call(GaimConversation *conv, | |
1186 const char *cmd, char **args, char **error) | |
1187 { | |
1188 GaimConnection *gc; | |
1189 SilcGaim sg; | |
1190 | |
1191 gc = gaim_conversation_get_gc(conv); | |
1192 | |
1193 if (gc == NULL) | |
1194 return GAIM_CMD_RET_FAILED; | |
1195 | |
1196 sg = gc->proto_data; | |
1197 | |
1198 if (sg == NULL) | |
1199 return GAIM_CMD_RET_FAILED; | |
1200 | |
1201 if (!silc_client_command_call(sg->client, sg->conn, args[0])) | |
1202 return GAIM_CMD_RET_FAILED; | |
1176 | 1203 |
1177 return GAIM_CMD_RET_OK; | 1204 return GAIM_CMD_RET_OK; |
1178 } | 1205 } |
1179 | 1206 |
1180 | 1207 |
1206 silcgaim_cmd_chat_list, _("list: List channels on this network")); | 1233 silcgaim_cmd_chat_list, _("list: List channels on this network")); |
1207 gaim_cmd_register("whois", "w", GAIM_CMD_P_PRPL, | 1234 gaim_cmd_register("whois", "w", GAIM_CMD_P_PRPL, |
1208 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | 1235 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, |
1209 "prpl-silc", | 1236 "prpl-silc", |
1210 silcgaim_cmd_whois, _("whois <nick>: View nick's information")); | 1237 silcgaim_cmd_whois, _("whois <nick>: View nick's information")); |
1211 gaim_cmd_register("invite", "w", GAIM_CMD_P_PRPL, | |
1212 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1213 "prpl-silc", silcgaim_cmd_chat_invite, | |
1214 _("invite <nick>: Invite nick to join this channel")); | |
1215 gaim_cmd_register("msg", "ws", GAIM_CMD_P_PRPL, | 1238 gaim_cmd_register("msg", "ws", GAIM_CMD_P_PRPL, |
1216 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | 1239 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, |
1217 "prpl-silc", silcgaim_cmd_msg, | 1240 "prpl-silc", silcgaim_cmd_msg, |
1218 _("msg <nick> <message>: Send a private message to a user")); | 1241 _("msg <nick> <message>: Send a private message to a user")); |
1219 gaim_cmd_register("query", "ws", GAIM_CMD_P_PRPL, | 1242 gaim_cmd_register("query", "ws", GAIM_CMD_P_PRPL, |
1226 _("motd: View the server's Message Of The Day")); | 1249 _("motd: View the server's Message Of The Day")); |
1227 gaim_cmd_register("detach", "", GAIM_CMD_P_PRPL, | 1250 gaim_cmd_register("detach", "", GAIM_CMD_P_PRPL, |
1228 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | 1251 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, |
1229 "prpl-silc", silcgaim_cmd_detach, | 1252 "prpl-silc", silcgaim_cmd_detach, |
1230 _("detach: Detach this session")); | 1253 _("detach: Detach this session")); |
1254 gaim_cmd_register("quit", "s", GAIM_CMD_P_PRPL, | |
1255 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1256 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_quit, | |
1257 ""); | |
1258 gaim_cmd_register("call", "s", GAIM_CMD_P_PRPL, | |
1259 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1260 "prpl-silc", silcgaim_cmd_call, | |
1261 ""); | |
1262 /* These below just get passed through for the silc client library to deal with */ | |
1263 gaim_cmd_register("kill", "ws", GAIM_CMD_P_PRPL, | |
1264 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1265 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1266 ""); | |
1267 gaim_cmd_register("nick", "w", GAIM_CMD_P_PRPL, | |
1268 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1269 "prpl-silc", silcgaim_cmd_generic, | |
1270 ""); | |
1271 gaim_cmd_register("cmode", "wws", GAIM_CMD_P_PRPL, | |
1272 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1273 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1274 ""); | |
1275 gaim_cmd_register("cumode", "wws", GAIM_CMD_P_PRPL, | |
1276 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1277 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1278 ""); | |
1231 gaim_cmd_register("umode", "w", GAIM_CMD_P_PRPL, | 1279 gaim_cmd_register("umode", "w", GAIM_CMD_P_PRPL, |
1232 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | 1280 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, |
1233 "prpl-silc", silcgaim_cmd_generic, | 1281 "prpl-silc", silcgaim_cmd_generic, |
1234 _("umode <usermodes>: Set your user options")); | 1282 _("umode <usermodes>: Set your user options")); |
1283 gaim_cmd_register("oper", "s", GAIM_CMD_P_PRPL, | |
1284 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1285 "prpl-silc", silcgaim_cmd_generic, | |
1286 ""); | |
1287 gaim_cmd_register("invite", "ws", GAIM_CMD_P_PRPL, | |
1288 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1289 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1290 ""); | |
1291 gaim_cmd_register("kick", "wws", GAIM_CMD_P_PRPL, | |
1292 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1293 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1294 ""); | |
1295 gaim_cmd_register("info", "ww", GAIM_CMD_P_PRPL, | |
1296 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1297 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1298 ""); | |
1299 gaim_cmd_register("ban", "ww", GAIM_CMD_P_PRPL, | |
1300 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1301 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1302 ""); | |
1303 gaim_cmd_register("ping", "", GAIM_CMD_P_PRPL, | |
1304 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1305 "prpl-silc", silcgaim_cmd_generic, | |
1306 ""); | |
1307 #if 0 /* Gaim doesn't handle the reply for these yet */ | |
1308 gaim_cmd_register("stats", "", GAIM_CMD_P_PRPL, | |
1309 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1310 "prpl-silc", silcgaim_cmd_generic, | |
1311 ""); | |
1312 gaim_cmd_register("whowas", "ww", GAIM_CMD_P_PRPL, | |
1313 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1314 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
1315 ""); | |
1316 gaim_cmd_register("users", "s", GAIM_CMD_P_PRPL, | |
1317 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1318 "prpl-silc", silcgaim_cmd_generic, | |
1319 ""); | |
1320 gaim_cmd_register("getkey", "w", GAIM_CMD_P_PRPL, | |
1321 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1322 "prpl-silc", silcgaim_cmd_generic, | |
1323 ""); | |
1324 #endif | |
1235 } | 1325 } |
1236 | 1326 |
1237 static GaimPluginPrefFrame * | 1327 static GaimPluginPrefFrame * |
1238 silcgaim_pref_frame(GaimPlugin *plugin) | 1328 silcgaim_pref_frame(GaimPlugin *plugin) |
1239 { | 1329 { |