Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitchX
GitHub Repository: BitchX/BitchX1.3
Path: blob/master/dll/aim/cmd.c
1072 views
1
/*
2
* AOL Instant Messanger Module for BitchX
3
*
4
* By Nadeem Riaz ([email protected])
5
*
6
* cmd.c
7
*
8
* User commands (aliases) (client -> libtoc)
9
*/
10
11
12
13
#include <irc.h>
14
#include <struct.h>
15
#include <hook.h>
16
#include <ircaux.h>
17
#include <output.h>
18
#include <lastlog.h>
19
#include <status.h>
20
#include <vars.h>
21
#include <window.h>
22
#include <sys/stat.h>
23
#include <module.h>
24
#include <modval.h>
25
26
#include <string.h>
27
#include <stdlib.h>
28
#include <stdio.h>
29
#include "toc.h"
30
#include "aim.h"
31
32
char current_chat[512];
33
char away_message[2048];
34
LL msgdus;
35
LL msgdthem;
36
37
/* Commands */
38
39
void asignon(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
40
char *user;
41
char *pass;
42
char *tochost,*authhost;
43
int tocport, authport;
44
int x;
45
46
if ( state == STATE_ONLINE ) {
47
statusprintf("You are already online.");
48
statusprintf("Please disconnect first (/asignoff), before trying to reoconnect.");
49
return;
50
}
51
52
user = get_dllstring_var("aim_user");
53
pass = get_dllstring_var("aim_pass");
54
tochost = get_dllstring_var("aim_toc_host");
55
authhost = get_dllstring_var("aim_auth_host");
56
x = get_dllint_var("aim_permdeny");
57
tocport = get_dllint_var("aim_toc_port");
58
authport = get_dllint_var("aim_auth_port");
59
60
61
if ( ! VALID_ARG(user) || ! VALID_ARG(pass) ) {
62
statusprintf("Please set your password and user name, by doing");
63
statusprintf("/set aim_user <user name>");
64
statusprintf("/set aim_pass <password>");
65
return;
66
}
67
68
/* This doent change anything-- should rm it */
69
if ( x < 1 || x > 4)
70
permdeny = PERMIT_PERMITALL;
71
else
72
permdeny = x;
73
74
75
if ( VALID_ARG(tochost) )
76
strncpy(aim_host,tochost,513);
77
if ( tocport > 0 && tocport < (64*1024) )
78
aim_port = tocport;
79
if ( VALID_ARG(authhost) )
80
strncpy(login_host,authhost,513);
81
if ( authport > 0 && authport < (64*1024) )
82
login_port = authport;
83
84
if ( toc_login(user,pass) < 0) {
85
statusprintf("Couldn't connect to instant messanger");
86
}
87
if ( get_dllint_var("aim_window") )
88
build_aim_status(get_window_by_name("AIM"));
89
90
msgdthem = CreateLL();
91
msgdus = CreateLL();
92
}
93
94
95
96
void asignoff(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
97
if ( state != STATE_ONLINE ) {
98
statusprintf("Please connect to aim first (/aconnect)");
99
return;
100
}
101
delete_timer("aimtime");
102
toc_signoff();
103
if ( get_dllint_var("aim_window") )
104
build_aim_status(get_window_by_name("AIM"));
105
FreeLL(msgdthem);
106
FreeLL(msgdus);
107
}
108
109
void amsg(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
110
char *nick,*nnick,*loc;
111
112
CHECK_TOC_ONLINE();
113
114
/* loc = msg, nick = username to send msg to */
115
loc = LOCAL_COPY(args);
116
nick = new_next_arg(loc, &loc);
117
118
REQUIRED_ARG(nick,command,helparg);
119
120
if ( nick[0] == '#' ) {
121
struct buddy_chat *b;
122
nick++;
123
REQUIRED_ARG(nick,command,helparg);
124
b = (struct buddy_chat *) find_buddy_chat(nick);
125
if ( ! b ) {
126
statusprintf("Error not on buddy chat %s", nick);
127
return;
128
}
129
/* chatprintf("sent msg %s to buddy chat %s",loc,nick); */
130
serv_chat_send(b->id,loc);
131
} else {
132
char *ruser,*rnick;
133
nnick = (char *) malloc(strlen(nick)+10);
134
rnick = rm_space(nick);
135
ruser = rm_space(get_dllstring_var("aim_user"));
136
sprintf(nnick,"%s@AIM",rnick);
137
msgprintf("%s", cparse(fget_string_var(FORMAT_SEND_MSG_FSET),
138
"%s %s %s %s",update_clock(GET_TIME),
139
nnick, ruser, loc));
140
serv_send_im(nick,loc);
141
RemoveFromLLByKey(msgdthem,rnick);
142
AddToLL(msgdthem,rnick,NULL);
143
#ifdef BITCHX_PATCH
144
tks.list = 0;
145
tks.pos = -1;
146
#endif
147
free(rnick); free(ruser);
148
}
149
150
debug_printf("sending msg to %s '%s'",nick,loc);
151
return;
152
}
153
154
void abl(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
155
char *cmd,*loc;
156
157
CHECK_TOC_ONLINE();
158
159
/* loc = msg, nick = username to send msg to */
160
loc = LOCAL_COPY(args);
161
cmd = new_next_arg(loc, &loc);
162
163
REQUIRED_ARG(cmd,command,helparg);
164
165
if ( ! strcasecmp(cmd,"show" ) ) {
166
struct buddy *b;
167
LLE tg,tb;
168
LL mems;
169
for ( TLL(groups,tg) ) {
170
mems = ((struct group *) tg->data)->members;
171
statusprintf("Group: %s", tg->key);
172
for ( TLL(mems,tb) ) {
173
b = (struct buddy *)tb->data;
174
statusprintf("\t\t%s %d",b->name,b->present);
175
}
176
}
177
} else if ( ! strcasecmp(cmd,"add") ) {
178
char *buddy,*group;
179
group = new_next_arg(loc, &loc);
180
REQUIRED_ARG(group,command,helparg);
181
182
if ( ! VALID_ARG(loc) ) {
183
buddy = group;
184
group = (char *) malloc(strlen("Buddies")+2);
185
strcpy(group,"Buddies");
186
} else {
187
buddy = new_next_arg(loc,&loc);
188
}
189
190
if ( user_add_buddy(group,buddy) > 0 ) {
191
statusprintf("Added buddy %s to group %s",buddy,group);
192
} else {
193
statusprintf("%s is already in your buddy list",buddy);
194
}
195
} else if ( ! strcasecmp(cmd,"del") ) {
196
char *buddy;
197
buddy = new_next_arg(loc,&loc);
198
REQUIRED_ARG(buddy,command,helparg);
199
200
if ( user_remove_buddy(buddy) > 0 ) {
201
statusprintf("Removed buddy %s",buddy);
202
} else {
203
statusprintf("%s is not in your buddy list",buddy);
204
}
205
} else if ( ! strcasecmp(cmd,"addg") ) {
206
char *group;
207
struct group *g;
208
group = new_next_arg(loc,&loc);
209
REQUIRED_ARG(group,command,helparg);
210
211
g = find_group(group);
212
if ( g ) {
213
statusprintf("Group %s already exists",args);
214
return;
215
}
216
217
add_group(group);
218
statusprintf("Created group %s",group);
219
} else if ( ! strcasecmp(cmd,"delg") ) {
220
char *group,*newgroup;
221
int ret;
222
223
group = new_next_arg(loc, &loc);
224
newgroup = new_next_arg(loc,&loc);
225
REQUIRED_ARG(group,command,helparg);
226
227
if ( ! VALID_ARG(newgroup) ) {
228
statusprintf("Usage: /abl delg <old group> 1 (delete group and all buddies in it)");
229
statusprintf(" /abl delg <old group> <new group> (delete group and move all buddies in it to new group)");
230
return;
231
}
232
233
if ( ! strcasecmp(newgroup,"1") )
234
ret = remove_group(group,NULL,2);
235
else
236
ret = remove_group(group,newgroup,1);
237
if ( ret > 0 )
238
statusprintf("Removed group %s",group);
239
else
240
statusprintf("Group %s doesn't exist",group);
241
} else
242
statusprintf("Error unknown buddy list management command: %s", cmd);
243
}
244
245
void awarn(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
246
char *buddy,*mode,*loc;
247
mode = NULL;
248
249
CHECK_TOC_ONLINE();
250
251
loc = LOCAL_COPY(args);
252
buddy = new_next_arg(loc, &loc);
253
mode = new_next_arg(loc,&loc);
254
255
REQUIRED_ARG(buddy,command,helparg);
256
257
if ( VALID_ARG(mode) && ! strcasecmp(mode,"anon") ) {
258
serv_warn(buddy,1);
259
} else {
260
serv_warn(buddy,0);
261
}
262
statusprintf("Warned: %s",buddy);
263
}
264
265
void apd(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
266
char *cmd,*loc;
267
loc = LOCAL_COPY(args);
268
cmd = new_next_arg(loc,&loc);
269
270
CHECK_TOC_ONLINE();
271
272
REQUIRED_ARG(cmd,command,helparg);
273
274
if ( ! strcasecmp(cmd,"show") ) {
275
LLE t;
276
statusprintf("User Mode: %s",((permdeny >= 1 && permdeny <= 4) ? PERMIT_MODES[permdeny] : "ERROR: Unknown"));
277
statusprintf("Permit:");
278
ResetLLPosition(permit);
279
while ( (t=GetNextLLE(permit)) ) {
280
statusprintf("\t\t%s",t->key);
281
}
282
283
ResetLLPosition(deny);
284
statusprintf("Deny:");
285
while ( (t=GetNextLLE(deny)) ) {
286
statusprintf("\t\t%s",t->key);
287
}
288
} else if ( ! strcasecmp(cmd,"mode") ) {
289
char *mode;
290
int newmode;
291
mode = new_next_arg(loc,&loc);
292
REQUIRED_ARG(mode,command,helparg);
293
294
if ( ! strcasecmp(mode,"permitall") ) {
295
newmode = PERMIT_PERMITALL;
296
} else if ( ! strcasecmp(mode,"denyall") ) {
297
newmode = PERMIT_DENYALL;
298
} else if ( ! strcasecmp(mode,"denysome") ) {
299
newmode = PERMIT_DENYSOME;
300
} else if ( ! strcasecmp(mode,"permitsome") ) {
301
newmode = PERMIT_PERMITSOME;
302
} else {
303
userage(command,helparg);
304
return;
305
}
306
307
if ( newmode == permdeny ) {
308
statusprintf("We are already in %s mode",mode);
309
return;
310
} else {
311
permdeny = newmode;
312
set_dllint_var("aim_permdeny_mode",permdeny);
313
serv_set_permit_deny();
314
serv_save_config();
315
}
316
317
statusprintf("Switch to %s mode",mode);
318
} else if ( !strcasecmp(cmd,"addp") ) {
319
char *buddy;
320
buddy = new_next_arg(loc,&loc);
321
REQUIRED_ARG(buddy,command,helparg);
322
323
if ( add_permit(buddy) < 0 ) {
324
statusprintf("%s is already in your permit list!");
325
return;
326
}
327
if ( permdeny != PERMIT_PERMITSOME )
328
statusprintf("Note: although %s will be added to your permit list, no tangible change will occur because you are in the improper mode (see help on apermdeny)",buddy);
329
statusprintf("Added %s to your permit list",buddy);
330
} else if ( !strcasecmp(cmd,"delp") ) {
331
char *buddy;
332
buddy = new_next_arg(loc,&loc);
333
REQUIRED_ARG(buddy,command,helparg);
334
335
if ( remove_permit(buddy) < 0 )
336
statusprintf("%s is not in your permit list!",buddy);
337
else
338
statusprintf("Remvoed %s from your permit list",buddy);
339
} else if ( !strcasecmp(cmd,"addd") ) {
340
char *buddy;
341
buddy = new_next_arg(loc,&loc);
342
REQUIRED_ARG(buddy,command,helparg);
343
344
if ( add_deny(buddy) < 0 ) {
345
statusprintf("%s is already in your deny list!");
346
return;
347
}
348
if ( permdeny != PERMIT_DENYSOME )
349
statusprintf("Note: although %s will be added to your deny list, no tangible change will occur because you are in the improper mode (see help on apermdeny)",buddy);
350
statusprintf("Added %s to your deny list",buddy);
351
} else if ( !strcasecmp(cmd,"deld") ) {
352
char *buddy;
353
buddy = new_next_arg(loc,&loc);
354
REQUIRED_ARG(buddy,command,helparg);
355
356
if ( remove_deny(buddy) < 0 )
357
statusprintf("%s is not in your deny list!",buddy);
358
else
359
statusprintf("Remvoed %s from your deny list",buddy);
360
} else
361
statusprintf("Error unknown permit/deny cmd %s",cmd);
362
}
363
364
void awhois(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
365
char *buddy,*loc;
366
struct buddy *b;
367
loc = LOCAL_COPY(args);
368
buddy = new_next_arg(loc,&loc);
369
370
CHECK_TOC_ONLINE();
371
372
REQUIRED_ARG(buddy,command,helparg);
373
374
b = find_buddy(buddy);
375
if ( ! b ) {
376
statusprintf("%s is not in your buddy list and thus I have no info stored on him/her",buddy);
377
return;
378
}
379
380
statusprintf("%s", cparse("������---�--��-������---�--��-���������--- -- -", NULL));
381
statusprintf("%s", cparse("| User : $0-", "%s", b->name));
382
statusprintf("%s", cparse("� Class : $0-", "%s", ((b->uc <= 5 && b->uc >= 0) ? USER_CLASSES[b->uc] : "Unknown")));
383
statusprintf("%s", cparse("� Evil : $0-", "%d", b->evil));
384
statusprintf("%s", cparse("� SignOn : $0-", "%s", my_ctime(b->signon)));
385
statusprintf("%s", cparse(": Idle : $0-", "%d", b->idle));
386
}
387
388
void asave (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
389
IrcVariableDll *newv = NULL;
390
FILE *outf = NULL;
391
char *expanded = NULL;
392
char buffer[BIG_BUFFER_SIZE+1];
393
if (get_string_var(CTOOLZ_DIR_VAR))
394
snprintf(buffer, BIG_BUFFER_SIZE, "%s/AIM.sav", get_string_var(CTOOLZ_DIR_VAR));
395
else
396
sprintf(buffer, "~/AIM.sav");
397
expanded = expand_twiddle(buffer);
398
if (!expanded || !(outf = fopen(expanded, "w")))
399
{
400
statusprintf("error opening %s", expanded ? expanded : buffer);
401
new_free(&expanded);
402
return;
403
}
404
for (newv = dll_variable; newv; newv = newv->next)
405
{
406
if (!my_strnicmp(newv->name, name, 3))
407
{
408
if (newv->type == STR_TYPE_VAR)
409
{
410
if (newv->string)
411
fprintf(outf, "SET %s %s\n", newv->name, newv->string);
412
}
413
else if (newv->type == BOOL_TYPE_VAR)
414
fprintf(outf, "SET %s %s\n", newv->name, on_off(newv->integer));
415
else
416
fprintf(outf, "SET %s %d\n", newv->name, newv->integer);
417
}
418
}
419
420
/* Buddy list, perm/deny list, etc. stored on AIM server */
421
422
/*
423
* Not sure what that does?
424
if (do_hook(MODULE_LIST, "NAP SAVE %s", buffer))
425
nap_say("Finished saving Napster variables to %s", buffer);
426
*/
427
statusprintf("Finished saving AIM variables to %s",buffer);
428
fclose(outf);
429
new_free(&expanded);
430
return;
431
}
432
433
void achat (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
434
char *arg1, *arg2, *arg3, *loc;
435
436
loc = LOCAL_COPY(args);
437
438
debug_printf("in achat!");
439
440
CHECK_TOC_ONLINE();
441
442
if ( ! strcasecmp(command,"asay") ) {
443
if ( VALID_ARG(current_chat) ) {
444
struct buddy_chat *b;
445
b = find_buddy_chat(current_chat);
446
if ( ! b ) {
447
statusprintf("Not on a buddy chat");
448
return;
449
}
450
serv_chat_send(b->id,loc);
451
} else
452
statusprintf("Not on a buddy chat");
453
} else if ( ! strcasecmp(command,"ajoin") ) {
454
arg1 = new_next_arg(loc,&loc);
455
REQUIRED_ARG(arg1,command,helparg);
456
if ( arg1[0] == '#' )
457
arg1++;
458
REQUIRED_ARG(arg1,command,helparg);
459
if ( find_buddy_chat(arg1) ) {
460
strncpy(current_chat,arg1,511);
461
return;
462
}
463
buddy_chat_join(arg1);
464
} else if ( ! strcasecmp(command,"apart") ) {
465
arg1 = new_next_arg(loc,&loc);
466
if ( VALID_ARG(arg1) && arg1[0] == '#' )
467
arg1++;
468
if ( VALID_ARG(arg1) ) {
469
if ( buddy_chat_leave(arg1) ) {
470
if ( ! strcasecmp(arg1,current_chat) ) {
471
/* Replace Current Chat */
472
strcpy(current_chat,"");
473
}
474
} else
475
statusprintf("Not on buddy chat %s",arg1);
476
} else {
477
if ( VALID_ARG(current_chat) ) {
478
buddy_chat_leave(current_chat);
479
/* Repalce Current Chat */
480
strcpy(current_chat,"");
481
} else
482
statusprintf("Not on a buddy chat");
483
}
484
} else if ( ! strcasecmp(command,"ainvite") ) {
485
arg1 = new_next_arg(loc,&loc);
486
arg2 = new_next_arg(loc,&loc);
487
arg3 = new_next_arg(loc,&loc);
488
REQUIRED_ARG(arg1,command,helparg);
489
if ( arg1[0] == '#' )
490
arg1++;
491
REQUIRED_ARG(arg1,command,helparg);
492
REQUIRED_ARG(arg2,command,helparg);
493
REQUIRED_ARG(arg3,command,helparg);
494
495
if ( buddy_chat_invite(arg1,arg2,arg3) < 0 ) {
496
statusprintf("Not on buddy chat %s",arg1);
497
}
498
} else if ( !strcasecmp(command,"achats") ) {
499
LLE t;
500
statusprintf("Currently on: ");
501
ResetLLPosition(buddy_chats);
502
while ( (t=GetNextLLE(buddy_chats)) ) {
503
statusprintf("\t\t%s",t->key);
504
}
505
} else if ( ! strcasecmp(command,"anames") ) {
506
char *chat;
507
arg1 = new_next_arg(loc,&loc);
508
if ( VALID_ARG(arg1) )
509
chat = arg1;
510
else
511
chat = current_chat;
512
if ( VALID_ARG(chat) ) {
513
struct buddy_chat *b;
514
LLE t;
515
b = find_buddy_chat(chat);
516
if ( ! b ) {
517
statusprintf("Not on buddy chat %s",chat);
518
return;
519
}
520
statusprintf("Names on %s",b->name);
521
ResetLLPosition(b->in_room);
522
while ( (t=GetNextLLE(b->in_room)) ) {
523
statusprintf("%s",t->key);
524
}
525
} else
526
statusprintf("Not on a buddy chat");
527
} else if ( ! strcasecmp(command,"acwarn") ) {
528
int anon = 0;
529
char *chat = NULL, *user = NULL, *mode = NULL;
530
arg1 = new_next_arg(loc, &loc);
531
arg2 = new_next_arg(loc,&loc);
532
arg3 = new_next_arg(loc,&loc);
533
if ( VALID_ARG(arg1) && VALID_ARG(arg2) && VALID_ARG(arg3) ) {
534
chat = arg1;
535
user = arg2;
536
mode = arg3;
537
} else if ( VALID_ARG(arg1) && VALID_ARG(arg2) ) {
538
chat = current_chat;
539
user = arg1;
540
mode = arg2;
541
} else if ( VALID_ARG(arg1) ) {
542
chat = current_chat;
543
user = arg2;
544
mode = NULL;
545
}
546
if ( VALID_ARG(mode) && ! strcasecmp(mode,"anon") )
547
anon = 1;
548
if ( chat[0] == '#' ) {
549
chat++;
550
REQUIRED_ARG(chat,command,helparg);
551
}
552
if ( buddy_chat_warn(chat,user,1) < 0 )
553
statusprintf("Not on buddy chat %s",chat);
554
else
555
statusprintf("Buddy Chat Warned %s",user);
556
} else
557
debug_printf("Unknown command in achat %s",command);
558
}
559
560
void adir (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
561
char *cmd,*loc;
562
563
loc = LOCAL_COPY(args);
564
cmd = new_next_arg(loc,&loc);
565
566
CHECK_TOC_ONLINE();
567
REQUIRED_ARG(cmd,command,helparg);
568
if ( !strcasecmp(cmd,"get") ) {
569
char *sn;
570
sn = new_next_arg(loc,&loc);
571
REQUIRED_ARG(sn,command,helparg);
572
573
serv_get_dir(sn);
574
} else if ( ! strcasecmp(cmd,"search") ) {
575
int fields = 0;
576
char *field,*data;
577
char *first,*middle,*last,*maiden;
578
char *city,*state,*country,*email;
579
first = middle = last = maiden = NULL;
580
city = state = country = email = NULL;
581
582
field = new_next_arg(loc,&loc);
583
while ( VALID_ARG(field) ) {
584
data = new_next_arg(loc,&loc);
585
if ( VALID_ARG(data) ) {
586
fields++;
587
if ( ! strcasecmp(field,"first") || ! strcasecmp(field,"-first") )
588
first = data;
589
else if ( ! strcasecmp(field,"middle") || ! strcasecmp(field,"-middle") )
590
middle = data;
591
else if ( ! strcasecmp(field,"last") || ! strcasecmp(field,"-last") )
592
last = data;
593
else if ( ! strcasecmp(field,"maiden") || ! strcasecmp(field,"-maiden") )
594
maiden = data;
595
else if ( ! strcasecmp(field,"city") || ! strcasecmp(field,"-city") )
596
city = data;
597
else if ( ! strcasecmp(field,"state") || ! strcasecmp(field,"-state") )
598
state = data;
599
else if ( ! strcasecmp(field,"country") || ! strcasecmp(field,"-country") )
600
country = data;
601
else if ( ! strcasecmp(field,"email") || ! strcasecmp(field,"-email") )
602
email = data;
603
else
604
statusprintf("Illegal field: %s",field);
605
} else {
606
statusprintf("No search item for field %s",field);
607
}
608
serv_dir_search(first,middle,last,maiden,city,state,country,email);
609
}
610
} else if ( ! strcasecmp(cmd,"set") ) {
611
char *first = new_next_arg(loc,&loc);
612
char *middle = new_next_arg(loc,&loc);
613
char *last = new_next_arg(loc,&loc);
614
char *maiden = new_next_arg(loc,&loc);
615
char *city = new_next_arg(loc,&loc);
616
char *state =new_next_arg(loc,&loc);
617
char *country = new_next_arg(loc,&loc);
618
char *email = new_next_arg(loc,&loc);
619
char *allow = new_next_arg(loc,&loc);
620
int x;
621
622
REQUIRED_ARG(allow,command,helparg);
623
if ( atoi(allow) ) {
624
x = 1;
625
} else {
626
x = 0;
627
}
628
/* apparently sending email messes this up? */
629
serv_set_dir(first,middle,last,maiden,city,state,country,email,x);
630
} else
631
debug_printf("Unknown command in adir %s",command);
632
}
633
634
void achange_idle(Window *w, char *s, int i) {
635
time_to_idle = i * 60;
636
debug_printf("time to idle = %d",time_to_idle);
637
}
638
639
void aaway (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
640
char *loc;
641
642
loc = LOCAL_COPY(args);
643
CHECK_TOC_ONLINE();
644
645
serv_set_away(args);
646
647
if ( is_away ) {
648
strncpy(away_message,args,2047);
649
statusprintf("You are now marked as away");
650
} else
651
statusprintf("You are now back.");
652
653
if ( get_dllint_var("aim_window") )
654
build_aim_status(get_window_by_name("AIM"));
655
}
656
657
void aquery(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
658
Window *tmp = NULL;
659
char *loc,*n,*msg;
660
char say[10] = "say";
661
662
CHECK_TOC_ONLINE();
663
loc = LOCAL_COPY(args);
664
n = new_next_arg(loc,&loc);
665
666
if ( get_dllint_var("aim_window") ) {
667
strcpy(say,"asay");
668
tmp = get_window_by_name("AIM");
669
}
670
if ( ! tmp )
671
tmp = current_window;
672
673
if ( VALID_ARG(n) ) {
674
#ifdef BITCHX_PATCH
675
msg = (char *) malloc(strlen(n)+50);
676
sprintf(msg,"-cmd amsg %s",n);
677
debug_printf("Querying: %s",msg);
678
window_query(tmp,&msg,NULL);
679
#else
680
681
msg = (char *) malloc(strlen(n)+10);
682
sprintf(msg,"amsg %s",n);
683
debug_printf("nick = '%s' msg = '%s'",n,msg);
684
#undef query_cmd
685
tmp->query_cmd = m_strdup("amsg");
686
#undef query_nick
687
tmp->query_nick = m_strdup(n);
688
update_input(tmp);
689
#endif
690
} else {
691
#undef query_cmd
692
tmp->query_cmd = m_strdup(say);
693
}
694
debug_printf("Leaking memory in aquery");
695
}
696
697
void ainfo(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
698
char *cmd,*loc;
699
700
loc = LOCAL_COPY(args);
701
cmd = new_next_arg(loc,&loc);
702
703
CHECK_TOC_ONLINE();
704
REQUIRED_ARG(cmd,command,helparg);
705
706
if ( ! strcasecmp(cmd,"get") ) {
707
char *nick = new_next_arg(loc,&loc);
708
REQUIRED_ARG(nick,command,helparg);
709
710
serv_get_info(nick);
711
} else if ( ! strcasecmp(cmd,"set") ) {
712
REQUIRED_ARG(loc,command,helparg);
713
serv_set_info(loc);
714
} else
715
statusprintf("Unknown command sent to ainfo: '%s'", cmd);
716
}
717
718