2 Copyright © 2002, The AROS Development Team.
8 //#include <exec/types.h>
14 #include <proto/alib.h>
15 #include <proto/exec.h>
16 #include <proto/dos.h>
17 #include <proto/intuition.h>
18 #include <proto/graphics.h>
19 #include <proto/muimaster.h>
22 #include <intuition/gadgetclass.h>
23 #include <intuition/icclass.h>
24 #include <clib/alib_protos.h>
26 #include <libraries/mui.h>
27 #include <mui/NListtree_mcc.h>
28 #include <mui/NListview_mcc.h>
29 #include <mui/NList_mcc.h>
30 #include <mui/BetterString_mcc.h>
32 #include <utility/hooks.h>
34 /* Start Network Includes */
35 #include <proto/socket.h>
36 #include <bsdsocket/socketbasetags.h>
37 //#include <sys/param.h>
38 #include <sys/socket.h>
39 #include <sys/ioctl.h>
40 #include <sys/errno.h>
43 #include <netinet/in.h>
44 #include <arpa/inet.h>
47 #include "aircos_global.h"
50 /* Texteditor + custom attributes */
51 #include <mui/TextEditor_mcc.h>
52 #define MUIA_CustTextEditor_ChannelPrivate (TextEditor_Dummy + 0xf01)
53 #define MUIA_CustTextEditor_ServerPrivate (TextEditor_Dummy + 0xf02)
55 extern struct AiRcOS_internal
*AiRcOS_Base
;
57 extern struct IRC_Channel_Priv
*FindNamedChannel( struct IRC_Connection_Private
*onThisConnection
, char *findThisChan
);
58 extern Object
*aircos_showServerConnect();
59 extern void aircosApp_setChanPen(struct IRC_Channel_Priv
*thisChanPriv
, ULONG pen
);
60 extern void aircosApp_showChanOutput(struct IRC_Channel_Priv
*thisChanPriv
, struct serv_Outline
*sa
);
61 extern int aircosApp_sendline(struct IRC_Connection_Private
*forConnection
);
63 /******* DATA : INTERN PROTOS *******/
65 struct IRC_Channel_Priv
*aircos_add_channel(char *addtoserv
,char *addchann
);
66 struct IRC_Channel_Group_User
*aircos_Add_ChannelUser( struct IRC_Channel_Priv
* addToChannel
, char * addToThisGroup
, char * addThisUser
);
67 struct IRC_Channel_Group_User
*aircos_Find_User( struct IRC_Channel_Priv
* searchChannel
, char * searchGroup
, char * findThisUser
);
69 /******* CODE START ********/
72 /******* SOCKET FUNCS ******/
74 /* The following 2 arrays MUST be in synch! */
75 struct textformat_codes
80 struct textformat_codes texted_codes
[] =
82 {"\033p[0]"}, //Color : BLACK
83 {"\033p[1]"}, //Color : DARK BLUE
84 {"\033p[2]"}, //Color : GREEN
85 {"\033p[3]"}, //Color : RED
86 {"\033p[4]"}, //Color : DARK RED
87 {"\033p[5]"}, //Color : PURPLE
88 {"\033p[6]"}, //Color : BROWN/ORANGE
89 {"\033p[7]"}, //Color : YELLOW
90 {"\033p[8]"}, //Color : LIGHT GREEN
91 {"\033p[9]"}, //Color : AQUA
92 {"\033p[10]"}, //Color : LIGHT BLUE
93 {"\033p[11]"}, //Color : BLUE
94 {"\033p[12]"}, //Color : VIOLET
95 {"\033p[13]"}, //Color : GREY
96 {"\033p[14]"}, //Color : LIGHT GRAY
97 {"\033p[15]"}, //Color : WHITE
98 {"\033n"}, //Format : normal
99 {"\033b"}, //Format : bold
100 {"\033n"}, //Format : reverse
101 {"\033u"}, //Format : underline
105 struct textformat_codes ircmessage_codes
[] =
107 {"\00301"}, //Color : BLACK
108 {"\00302"}, //Color : DARK BLUE
109 {"\00303"}, //Color : GREEN
110 {"\00304"}, //Color : RED
111 {"\00305"}, //Color : DARK RED
112 {"\00306"}, //Color : PURPLE
113 {"\00307"}, //Color : BROWN/ORANGE
114 {"\00308"}, //Color : YELLOW
115 {"\00309"}, //Color : LIGHT GREEN
116 {"\00310"}, //Color : AQUA
117 {"\00311"}, //Color : LIGHT BLUE
118 {"\00312"}, //Color : BLUE
119 {"\00313"}, //Color : VIOLET
120 {"\00314"}, //Color : GREY
121 {"\00315"}, //Color : LIGHT GRAY
122 {"\00316"}, //Color : WHITE
123 {"\017"}, //Format : normal
124 {"\002"}, //Format : bold
125 {"\026"}, //Format : reverse
126 {"\037"}, //Format : underline
130 char *FormatToSend(char *unformatted_string
)
132 /* Convert all Input notation formatting to IRC noatation */
134 return unformatted_string
;
137 char *FormatToDisplay(char *formatted_string
)
139 int pos
= 0, code
= 0, swap_code
= 0;
140 APTR buff_position
= NULL
;
141 BOOL format_bold
= FALSE
, format_reverse
= FALSE
, format_underline
= FALSE
, format_cleared
= FALSE
;
143 D(bug("[AiRcOS] formattodisplay( %d chars, '%s')\n", strlen(formatted_string
), formatted_string
));
145 if (!(formatted_string
))
147 D(bug("[AiRcOS] formattodisplay: ERROR - Called with NULL string pointer\n"));
150 if (strlen(formatted_string
)==0)
152 D(bug("[AiRcOS] formattodisplay: ERROR - Called with 0 length string\n"));
155 for (pos
= 0; pos
< strlen(formatted_string
); pos
++)
157 buff_position
= formatted_string
+ pos
;
158 for (code
= 0; ircmessage_codes
[code
].char_code
!= NULL
; code
++)
160 ULONG src_code_len
= strlen(ircmessage_codes
[code
].char_code
);
162 if ((strncmp(buff_position
, ircmessage_codes
[code
].char_code
, src_code_len
)==0))
164 D(bug("[AiRcOS] formattodisplay: Matched IRC code %d @ %d\n", code
, pos
));
165 char *new_format
= NULL
;
173 D(bug("[AiRcOS] formattodisplay: BOLD OFF\n"));
175 format_cleared
= TRUE
;
176 new_format
= texted_codes
[16].char_code
;
180 D(bug("[AiRcOS] formattodisplay: BOLD ON\n"));
189 D(bug("[AiRcOS] formattodisplay: REVERSE OFF\n"));
190 format_reverse
= FALSE
;
191 format_cleared
= TRUE
;
192 new_format
= texted_codes
[16].char_code
;
196 format_reverse
= TRUE
;
197 D(bug("[AiRcOS] formattodisplay: REVERSE ON\n"));
203 if (format_underline
)
205 D(bug("[AiRcOS] formattodisplay: UNDERLINE OFF\n"));
206 format_underline
= FALSE
;
207 format_cleared
= TRUE
;
208 new_format
= texted_codes
[16].char_code
;
212 D(bug("[AiRcOS] formattodisplay: UNDERLINE ON\n"));
213 format_underline
= TRUE
;
221 if (!(new_format
)) new_format
= texted_codes
[code
].char_code
;
222 ULONG dst_code_len
= strlen(new_format
);
223 ULONG fmt_code_len
= dst_code_len
;
225 if ((src_code_len
) == (dst_code_len
))
227 D(bug("[AiRcOS] formattodisplay: Escape sequence substitution possible (equal length sequences)\n"));
231 char *format_line
= buff_position
;
232 D(bug("[AiRcOS] formattodisplay: Substiting escape sequences\n"));
233 for (swap_code
= 0; swap_code
< strlen(new_format
); swap_code
++)
235 format_line
[swap_code
] = new_format
[swap_code
];
238 else if ((src_code_len
) < (dst_code_len
))
240 ULONG diff
= dst_code_len
- src_code_len
;
241 D(bug("[AiRcOS] formattodisplay: new Escape sequence is %d bytes longer!!\n", diff
));
242 char * tmp_string
= NULL
;
243 if ((tmp_string
= AllocVec(strlen(formatted_string
) + diff
+ 1, MEMF_CLEAR
|MEMF_PUBLIC
)))
247 D(bug("[AiRcOS] formattodisplay: copied string start (%d bytes)\n", pos
));
248 CopyMem(formatted_string
, tmp_string
, pos
);
251 ULONG remaining_chars
= strlen(formatted_string
) - (pos
+ src_code_len
);
252 if (remaining_chars
> 0)
254 D(bug("[AiRcOS] formattodisplay: copied string end(%d bytes)\n", remaining_chars
));
255 CopyMem(buff_position
+ src_code_len
, tmp_string
+ pos
+ dst_code_len
, remaining_chars
);
258 FreeVec(formatted_string
);
259 formatted_string
= tmp_string
;
260 buff_position
= formatted_string
+ pos
;
267 D(ULONG diff
= src_code_len
- dst_code_len
;)
268 D(bug("[AiRcOS] formattodisplay: new Escape sequence is %d bytes shorter!!\n", diff
));
271 formatted_string
[strlen(formatted_string
)+1] = '\0';
272 pos
= pos
+ fmt_code_len
;
273 D(bug("[AiRcOS] formattodisplay: new string %d chars, '%s'\n", strlen(formatted_string
), formatted_string
));
277 D(bug("[AiRcOS] formattodisplay: Format reset - checking if we need to inject enabled styles..\n"));
280 new_format
= texted_codes
[17].char_code
;
281 int newstr_size
= strlen(formatted_string
) + strlen(new_format
) + 1;
282 char * tmp_string
= NULL
;
283 if ((tmp_string
= AllocVec(newstr_size
, MEMF_CLEAR
|MEMF_PUBLIC
)))
285 D(bug("[AiRcOS] formattodisplay: injecting BOLD sequence (new buff %d bytes@ %x)\n", newstr_size
, tmp_string
));
289 D(bug("[AiRcOS] formattodisplay: inject_bold: copied string start (%d bytes)\n", pos
));
290 CopyMem(formatted_string
, tmp_string
, pos
);
293 char *format_line
= tmp_string
+ pos
;
294 D(bug("[AiRcOS] formattodisplay: inject_bold: inserting code ..)\n"));
295 for (swap_code
= 0; swap_code
< strlen(new_format
); swap_code
++)
297 format_line
[swap_code
] = new_format
[swap_code
];
300 ULONG remaining_chars
= strlen(formatted_string
) - pos
;
302 pos
= pos
+ strlen(new_format
);
303 if (remaining_chars
> 0)
305 D(bug("[AiRcOS] formattodisplay: inject_bold: copied string end (%d bytes)\n", remaining_chars
));
306 CopyMem(formatted_string
+ cursrcpos
, tmp_string
+ pos
, remaining_chars
);
309 FreeVec(formatted_string
);
310 formatted_string
= tmp_string
;
311 formatted_string
[strlen(formatted_string
)+1] = '\0';
312 buff_position
= formatted_string
+ pos
;
318 D(bug("[AiRcOS] formattodisplay: injecting REVERSE sequence\n"));
321 if (format_underline
)
323 D(bug("[AiRcOS] formattodisplay: injecting UNDERLINE sequence\n"));
325 format_cleared
= FALSE
;
328 if ((format_bold
)||(format_reverse
)||(format_underline
))
330 D(bug("[AiRcOS] formattodisplay: new string %d chars, '%s'\n", strlen(formatted_string
), formatted_string
));
339 return formatted_string
;
342 /* ************** IRC OPERATIONS !! ***************************** */
343 /** SERVER SIDE COMMANDS (RECIEVING) **/
345 int aircos_IRC_nop(struct IRC_Connection_Private
*currentConnection
)
347 struct serv_Outline
*sa
;
349 D(bug("[AiRcOS] ## IRC ## NOP('%s')\n",currentConnection
->connection_unprocessed
));
351 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
353 sa
->so_name
= AllocVec(strlen( currentConnection
->connection_unprocessed
) + strlen("%s\n") + 1, MEMF_CLEAR
|MEMF_PUBLIC
);
354 sprintf( sa
->so_name
, "%s\n", currentConnection
->connection_unprocessed
);
356 // sa->so_name = FormatToDisplay(sa->so_name);
358 DoMethod( currentConnection
->connected_server
->serv_status_output
, MUIM_TextEditor_InsertText
, sa
->so_name
, MUIV_TextEditor_InsertText_Bottom
);
364 static int aircos_IRC_doerror(struct IRC_Connection_Private
*currentConnection
)
366 D(bug("[AiRcOS] ## IRC ## DoError()\n"));
370 static int aircos_IRC_doinvite(struct IRC_Connection_Private
*currentConnection
)
372 D(bug("[AiRcOS] ## IRC ## DoInvite()\n"));
376 static int aircos_IRC_dojoin(struct IRC_Connection_Private
*currentConnection
)
378 D(bug("[AiRcOS] ## IRC ## DoJoin('%s') [ nick='%s', server ='%s' ]\n", currentConnection
->connection_serv_ARGS
[0], currentConnection
->connection_nick
, currentConnection
->connection_server
));
380 if (strcasecmp(currentConnection
->connection_serv_ARGS
[0], currentConnection
->connection_nick
) == 0)
382 D(bug("[AiRcOS]#DoJoin# YOU have joined channel ..\n"));
383 struct IRC_Channel_Priv
*irc_newChannel
= NULL
;
384 irc_newChannel
= aircos_add_channel(currentConnection
->connected_server
->serv_name
, currentConnection
->connection_serv_ARGS
[2]);
385 (void)irc_newChannel
; // FIXME: Should we check for success?
389 D(bug("[AiRcOS]#DoJoin# User '%s' joined channel ..\n",currentConnection
->connection_serv_ARGS
[0]));
391 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
392 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[2])))
394 D(bug("[AiRcOS](irc:DoJoin) Found internal channel record\n"));
395 char *username
= currentConnection
->connection_serv_ARGS
[0];
397 struct serv_Outline
*sa
;
399 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
401 D(bug("[AiRcOS](irc:DoJoin) Displaying Message\n"));
402 sa
->so_name
= AllocVec(strlen( username
) + strlen( currentConnection
->connection_serv_ARGS
[2] ) + strlen(_(MSG_USER_JOINED
)) + 1, MEMF_CLEAR
|MEMF_PUBLIC
);
403 sprintf( sa
->so_name
, _(MSG_USER_JOINED
), username
, currentConnection
->connection_serv_ARGS
[2] );
405 aircosApp_setChanPen(thisChanPriv
, 4);
406 aircosApp_showChanOutput(thisChanPriv
, sa
);
407 aircosApp_setChanPen(thisChanPriv
, 0);
410 /* Add the user to the usergroup */
411 if (username
[0] == '@') aircos_Add_ChannelUser( thisChanPriv
, (char *)_(MSG_ADMINS
), username
+1);
412 else if (username
[0] == '+') aircos_Add_ChannelUser( thisChanPriv
, (char *)_(MSG_VOICE
), username
+1);
413 else aircos_Add_ChannelUser( thisChanPriv
, (char *)_(MSG_NORMAL
), username
);
420 static int aircos_IRC_dokick(struct IRC_Connection_Private
*currentConnection
)
422 D(bug("[AiRcOS] ## IRC ## DoKick()\n"));
423 // printf("*** %s was kicked from %s by %s (%s)", currentConnection->connection_serv_ARGS[3], currentConnection->connection_serv_ARGS[2], currentConnection->connection_serv_ARGS[0], currentConnection->connection_serv_ARGS[4]);
428 static int aircos_IRC_dokill(struct IRC_Connection_Private
*currentConnection
)
430 D(bug("[AiRcOS] ## IRC ## DoKill()\n"));
431 // printf("*** %s killed by %s: ", currentConnection->connection_serv_ARGS[3], currentConnection->connection_serv_ARGS[0]);
432 if (strcasecmp(currentConnection
->connection_serv_ARGS
[3], currentConnection
->connection_nick
) == 0) AiRcOS_Base
->Ai_reconnect
= 0;
436 static int aircos_IRC_domode(struct IRC_Connection_Private
*currentConnection
)
438 D(bug("[AiRcOS] ## IRC ## DoMode()\n"));
440 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
442 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[2])))
444 D(bug("[AiRcOS](irc;DoMode) Found record for channel '%s'\n", currentConnection
->connection_serv_ARGS
[2]));
445 /* Find users usergroup record and remove */
446 struct IRC_Channel_Group_SubGroup
*current_Group
=NULL
;
447 ForeachNode(&thisChanPriv
->chan_usergroup
, current_Group
)
449 struct IRC_Channel_Group_User
*change_ChanUser
= NULL
;
450 if (( change_ChanUser
= aircos_Find_User( thisChanPriv
, current_Group
->group_name
, currentConnection
->connection_serv_ARGS
[4])))
452 D(bug("[AiRcOS](irc;DoMode) Users Record for '%s' found\n", currentConnection
->connection_serv_ARGS
[4]));
453 char *new_modeset
= currentConnection
->connection_serv_ARGS
[3];
454 char *new_group
= NULL
;
456 D(bug("[AiRcOS](irc;DoMode) Checking if mode changed ..\n"));
457 if (new_modeset
[1] == 'o')
459 if (new_modeset
[0] == '+') new_group
= (char *)_(MSG_ADMINS
);
460 else new_group
= (char *)_(MSG_NORMAL
);
462 else if (new_modeset
[1] == 'v')
464 if (new_modeset
[0] == '+') new_group
= (char *)_(MSG_VOICE
);
465 else new_group
= (char *)_(MSG_NORMAL
);
469 new_group
= (char *)_(MSG_NORMAL
);
472 if (strcasecmp(current_Group
->group_name
, new_group
)!=0)
474 D(bug("{AiRcOS](irc;DoMode) CHANGE : removing old user record\n"));
475 Remove(&change_ChanUser
->group_node
);
476 struct serv_Outline
*sa
= NULL
;
478 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
)))
480 D(bug("[AiRcOS](irc;DoMode) Displaying Message\n"));
481 sa
->so_name
= AllocVec(strlen( currentConnection
->connection_serv_ARGS
[0] ) + strlen( currentConnection
->connection_serv_ARGS
[3] ) + strlen( currentConnection
->connection_serv_ARGS
[4] ) + strlen(_(MSG_SET_MODE
)) + 1, MEMF_CLEAR
);
482 sprintf( sa
->so_name
, _(MSG_SET_MODE
), currentConnection
->connection_serv_ARGS
[0], currentConnection
->connection_serv_ARGS
[3], currentConnection
->connection_serv_ARGS
[4]);
484 aircosApp_setChanPen(thisChanPriv
, 4);
485 aircosApp_showChanOutput(thisChanPriv
,sa
);
486 aircosApp_setChanPen(thisChanPriv
, 0);
489 DoMethod( thisChanPriv
->chan_users
, MUIM_NListtree_Remove
, MUIV_NListtree_Remove_ListNode_Root
, change_ChanUser
->user_obj
);
490 D(bug("[AiRcOS](irc;DoMode) ReInserting User\n"));
491 aircos_Add_ChannelUser( thisChanPriv
, new_group
, change_ChanUser
->user_name
);
493 D(bug("[AiRcOS](irc;DoMode) Freeing old User resources\n"));
494 FreeVec(change_ChanUser
->user_displayname
);
495 FreeVec(change_ChanUser
->user_name
);
496 FreeVec(change_ChanUser
);
500 D(bug("[AiRcOS](irc;DoMode) Mode remains the same\n"));
508 static int aircos_IRC_donick(struct IRC_Connection_Private
*currentConnection
)
510 D(bug("[AiRcOS] ## IRC ## DoNick()\n"));
512 char *nicknamenew
= NULL
;
514 if (strcasecmp(currentConnection
->connection_serv_ARGS
[0], currentConnection
->connection_nick
) == 0)
516 if ((nicknamenew
= (char *)AllocVec(strlen(currentConnection
->connection_serv_ARGS
[2])+1,MEMF_CLEAR
)))
518 strcpy(nicknamenew
, currentConnection
->connection_serv_ARGS
[2]);
519 FreeVec(currentConnection
->connection_nick
);
520 currentConnection
->connection_nick
= nicknamenew
;
524 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
526 char *username
= currentConnection
->connection_serv_ARGS
[0];
527 nicknamenew
= currentConnection
->connection_serv_ARGS
[2];
529 ForeachNode(¤tConnection
->connected_server
->serv_chans
, thisChanPriv
)
531 D(bug("[AiRcOS](irc;DoNick) Searching For user record on '%s'\n",thisChanPriv
->chan_name
));
533 struct serv_Outline
*sa
= NULL
;
535 /* Find users usergroup record and remove */
536 struct IRC_Channel_Group_SubGroup
*current_Group
=NULL
;
537 ForeachNode(&thisChanPriv
->chan_usergroup
, current_Group
)
539 struct IRC_Channel_Group_User
*rename_ChanUser
= NULL
;
540 if ((rename_ChanUser
= aircos_Find_User( thisChanPriv
, current_Group
->group_name
, username
)))
542 D(bug("[AiRcOS](irc;DoNick) Users Record found - removing\n"));
543 Remove(&rename_ChanUser
->group_node
);
545 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
547 D(bug("[AiRcOS](irc;DoNick) Displaying Message\n"));
548 sa
->so_name
= AllocVec(strlen( username
) + strlen( nicknamenew
) + strlen(_(MSG_CHANGED_NICK
)) + 1,MEMF_CLEAR
|MEMF_PUBLIC
);
549 sprintf( sa
->so_name
, _(MSG_CHANGED_NICK
), username
, nicknamenew
);
551 aircosApp_setChanPen(thisChanPriv
, 4);
552 aircosApp_showChanOutput(thisChanPriv
,sa
);
553 aircosApp_setChanPen(thisChanPriv
, 0);
556 DoMethod( thisChanPriv
->chan_users
, MUIM_NListtree_Remove
, MUIV_NListtree_Remove_ListNode_Root
, rename_ChanUser
->user_obj
);
558 FreeVec(rename_ChanUser
->user_displayname
);
559 FreeVec(rename_ChanUser
->user_name
);
560 FreeVec(rename_ChanUser
);
562 aircos_Add_ChannelUser( thisChanPriv
, current_Group
->group_name
, nicknamenew
);
570 static int aircos_IRC_donotice(struct IRC_Connection_Private
*currentConnection
)
572 D(bug("[AiRcOS] ## IRC ## DoNotice()\n"));
574 if (!isIRCChannel(currentConnection
->connection_serv_ARGS
[2]))
576 D(bug("[AiRcOS](irc;DoNotice.?) Do Server notice?\n"));
580 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
581 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[2])))
583 D(bug("[AiRcOS](irc;DoNotice.chan) Found internal channel record\n"));
584 char *username
= currentConnection
->connection_serv_ARGS
[0];
586 struct serv_Outline
*sa
;
588 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
590 D(bug("[AiRcOS](irc;DoNotice.chan) Displaying Message\n"));
591 sa
->so_name
= AllocVec(strlen( username
) + strlen( currentConnection
->connection_serv_ARGS
[3] ) + strlen(_(MSG_DO_NOTICE
)) + 1,MEMF_CLEAR
|MEMF_PUBLIC
);
592 sprintf( sa
->so_name
, _(MSG_DO_NOTICE
), username
, currentConnection
->connection_serv_ARGS
[3] );
594 aircosApp_setChanPen(thisChanPriv
, 2);
595 aircosApp_showChanOutput(thisChanPriv
,sa
);
596 aircosApp_setChanPen(thisChanPriv
, 0);
604 static int aircos_IRC_dopart(struct IRC_Connection_Private
*currentConnection
)
606 D(bug("[AiRcOS] ## IRC ## DoPart()\n"));
608 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
610 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[2])))
612 D(bug("[AiRcOS](irc;DoPart) Found internal channel record\n"));
614 char *username
= currentConnection
->connection_serv_ARGS
[0];
616 struct serv_Outline
*sa
;
618 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
620 D(bug("[AiRcOS](irc;DoPart) Displaying Message\n"));
621 sa
->so_name
= AllocVec(strlen( username
) + strlen( currentConnection
->connection_serv_ARGS
[2] ) + strlen(_(MSG_HAS_LEFT
)) + 1,MEMF_CLEAR
|MEMF_PUBLIC
);
622 sprintf(sa
->so_name
, _(MSG_HAS_LEFT
), username
, currentConnection
->connection_serv_ARGS
[2] );
624 aircosApp_setChanPen(thisChanPriv
, 7);
625 aircosApp_showChanOutput(thisChanPriv
,sa
);
626 aircosApp_setChanPen(thisChanPriv
, 0);
628 /* Find users usergroup record and remove */
629 struct IRC_Channel_Group_SubGroup
*current_Group
=NULL
;
630 ForeachNode(&thisChanPriv
->chan_usergroup
, current_Group
)
632 struct IRC_Channel_Group_User
*left_ChanUser
= NULL
;
633 if ((left_ChanUser
= aircos_Find_User( thisChanPriv
, current_Group
->group_name
, username
)))
635 D(bug("[AiRcOS](irc;DoPart) Users Record found - removing\n"));
636 Remove(&left_ChanUser
->group_node
);
637 DoMethod( thisChanPriv
->chan_users
, MUIM_NListtree_Remove
, MUIV_NListtree_Remove_ListNode_Root
, left_ChanUser
->user_obj
);
639 FreeVec(left_ChanUser
->user_displayname
);
640 FreeVec(left_ChanUser
->user_name
);
641 FreeVec(left_ChanUser
);
649 static int aircos_IRC_dopong(struct IRC_Connection_Private
*currentConnection
)
651 D(bug("[AiRcOS] ## IRC ## DoPong()\n"));
653 // column = printf("*** Got PONG from %s:", currentConnection->connection_serv_ARGS[0]);
657 static int aircos_IRC_handleAction(struct IRC_Connection_Private
*currentConnection
)
659 D(bug("[AiRcOS] handleAction('%s')\n", currentConnection
->connection_unprocessed
));
660 if ((AiRcOS_Base
->Ai_tmp
= strchr(currentConnection
->connection_unprocessed
, ' ')))
662 char *action_command
= NULL
;
663 char *action_param
= NULL
;
665 ULONG action_command_len
= AiRcOS_Base
->Ai_tmp
- currentConnection
->connection_unprocessed
;
666 D(bug("[AiRcOS](irc;handleAction) command length %d\n", action_command_len
));
668 if (!(action_command
= AllocVec(action_command_len
+ 2, MEMF_CLEAR
)))
671 strncpy(action_command
, currentConnection
->connection_unprocessed
, action_command_len
);
672 action_command
[action_command_len
+1] = '\0';
673 action_param
= currentConnection
->connection_unprocessed
+ action_command_len
+1;
675 /* Handle Actions .. */
677 if (strcmp("ACTION",action_command
)==0)
679 D(bug("[AiRcOS](irc;handleAction) Found 'ACTION' command\n"));
680 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
681 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[2])))
683 D(bug("[AiRcOS](irc;handleAction) 'ACTION' : Found internal channel record\n"));
684 struct serv_Outline
*sa
= NULL
;
685 char *username
= currentConnection
->connection_serv_ARGS
[0];
687 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
689 D(bug("[AiRcOS](irc;handleAction) 'ACTION' : Displaying Message\n"));
690 sa
->so_name
= AllocVec(strlen( username
) + strlen( action_param
) + strlen(_(MSG_HANDLE_ACTION
)) + 1,MEMF_CLEAR
|MEMF_PUBLIC
);
692 sprintf( sa
->so_name
, _(MSG_HANDLE_ACTION
), username
, action_param
);
694 aircosApp_setChanPen(thisChanPriv
, 8);
695 aircosApp_showChanOutput(thisChanPriv
,sa
);
696 aircosApp_setChanPen(thisChanPriv
, 0);
701 // else if (strcmp("XXXXXXX",action_command)==0)
702 // else if (strcmp("XXXXXXX",action_command)==0)
707 static int aircos_IRC_doprivmsg(struct IRC_Connection_Private
*currentConnection
)
709 D(bug("[AiRcOS] ## IRC ## DoPrivMsg()\n"));
711 // TODO : DoPrivMsg() If the user is on our ignore list, do nothing.."
713 if (!isIRCChannel(currentConnection
->connection_serv_ARGS
[2]))
715 D(bug("[AiRcOS](irc;DoPrivMsg) Doing PrivMessage from .. A\n"));
719 /* Handle channel message */
720 D(bug("[AiRcOS](irc;DoPrivMsg) Doing PrivMessage from .. B\n"));
721 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
723 if (*currentConnection
->connection_serv_ARGS
[3] == '\001')
725 // Handle Action message
726 D(bug("[AiRcOS](irc;DoPrivMsg.B) Handle ACTION message ...\n"));
727 char * end_actionmsg
= currentConnection
->connection_serv_ARGS
[3];
730 for ( i
= 1; i
< strlen(currentConnection
->connection_serv_ARGS
[3]); i
++)
732 if (end_actionmsg
[i
] == '\001')
734 end_actionmsg
[i
] = '\0';
735 end_actionmsg
= &end_actionmsg
[i
];
740 if ((end_actionmsg
!= currentConnection
->connection_serv_ARGS
[3])&&(currentConnection
->connection_unprocessed
))
742 ULONG actionmsg_size
= end_actionmsg
- currentConnection
->connection_serv_ARGS
[3];
744 D(bug("[AiRcOS](irc;DoPrivMsg.B) Processing ACTION Message [len:%d]\n", actionmsg_size
));
745 strncpy(currentConnection
->connection_unprocessed
, currentConnection
->connection_serv_ARGS
[3] +1, actionmsg_size
);
746 aircos_IRC_handleAction(currentConnection
);
751 D(bug("[AiRcOS](irc;DoPrivMsg.B) Handle Standard message ...\n"));
752 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[2])))
754 D(bug("[AiRcOS](irc;DoPrivMsg.B) Found internal channel record\n"));
756 char *username
= currentConnection
->connection_serv_ARGS
[0];
758 struct serv_Outline
*sa
;
760 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
762 D(bug("[AiRcOS](irc;DoPrivMsg) B: Displaying Message\n"));
763 sa
->so_name
= AllocVec(strlen( username
) + strlen( currentConnection
->connection_serv_ARGS
[3] ) + strlen("<%s> %s\n") + 1,MEMF_CLEAR
|MEMF_PUBLIC
);
764 sprintf( sa
->so_name
, "<%s> %s\n", username
, currentConnection
->connection_serv_ARGS
[3] );
766 aircosApp_showChanOutput(thisChanPriv
,sa
);
775 static int aircos_IRC_doquit(struct IRC_Connection_Private
*currentConnection
)
777 D(bug("[AiRcOS] ## IRC ## DoQuit()\n"));
779 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
780 char *username
= currentConnection
->connection_serv_ARGS
[0];
782 ForeachNode(¤tConnection
->connected_server
->serv_chans
, thisChanPriv
)
784 D(bug("[AiRcOS](irc;DoPart) Searching For user record on '%s'\n",thisChanPriv
->chan_name
));
785 struct serv_Outline
*sa
= NULL
;
787 /* Find users usergroup record and remove */
788 struct IRC_Channel_Group_SubGroup
*current_Group
=NULL
;
789 ForeachNode(&thisChanPriv
->chan_usergroup
, current_Group
)
791 struct IRC_Channel_Group_User
*left_ChanUser
= NULL
;
792 if ((left_ChanUser
= aircos_Find_User( thisChanPriv
, current_Group
->group_name
, username
)))
794 D(bug("[AiRcOS](irc;DoQuit) Users Record found - removing\n"));
795 Remove(&left_ChanUser
->group_node
);
797 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
799 D(bug("[AiRcOS](irc;DoQuit) Displaying Message\n"));
800 sa
->so_name
= AllocVec(strlen( username
) + strlen( currentConnection
->connection_serv_ARGS
[2] ) + strlen(_(MSG_HAS_QUIT
)) + 1,MEMF_CLEAR
|MEMF_PUBLIC
);
801 sprintf( sa
->so_name
, _(MSG_HAS_QUIT
), username
, currentConnection
->connection_serv_ARGS
[2] );
803 aircosApp_setChanPen(thisChanPriv
, 7);
804 aircosApp_showChanOutput(thisChanPriv
,sa
);
805 aircosApp_setChanPen(thisChanPriv
, 0);
808 DoMethod( thisChanPriv
->chan_users
, MUIM_NListtree_Remove
, MUIV_NListtree_Remove_ListNode_Root
, left_ChanUser
->user_obj
);
810 FreeVec(left_ChanUser
->user_displayname
);
811 FreeVec(left_ChanUser
->user_name
);
812 FreeVec(left_ChanUser
);
820 static int aircos_IRC_dotopic(struct IRC_Connection_Private
*currentConnection
)
822 D(bug("[AiRcOS] ## IRC ## DoTopic()\n"));
824 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
826 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[2])))
829 D(bug("[AiRcOS](irc;DoTopic) Changing topic display\n"));
831 char *tmptopic
= AllocVec(strlen(currentConnection
->connection_serv_ARGS
[3]) + strlen(thisChanPriv
->chan_name
)+4,MEMF_CLEAR
);
833 sprintf(tmptopic
, "%s: %s", thisChanPriv
->chan_name
, currentConnection
->connection_serv_ARGS
[3]);
834 set(thisChanPriv
->chan_topic_obj
, MUIA_Text_Contents
, tmptopic
);
835 if (thisChanPriv
->chan_topic
) FreeVec(thisChanPriv
->chan_topic
);
836 thisChanPriv
->chan_topic
= tmptopic
;
838 /* Output confirmation of the change on the channel */
840 char *username
= currentConnection
->connection_serv_ARGS
[0];
841 struct serv_Outline
*sa
;
843 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
845 D(bug("[AiRcOS](irc;DoTopic) Displaying Message in local channel\n"));
846 sa
->so_name
= AllocVec(strlen( username
) + strlen( currentConnection
->connection_serv_ARGS
[3] ) + strlen(_(MSG_CHANGES_TOPIC
)) + 1,MEMF_CLEAR
|MEMF_PUBLIC
);
847 sprintf(sa
->so_name
, _(MSG_CHANGES_TOPIC
), username
, currentConnection
->connection_serv_ARGS
[3] );
849 aircosApp_setChanPen(thisChanPriv
, 4);
850 aircosApp_showChanOutput(thisChanPriv
,sa
);
851 aircosApp_setChanPen(thisChanPriv
, 0);
858 int aircos_IRC_donumeric(struct IRC_Connection_Private
*currentConnection
, int num
)
860 D(bug("[AiRcOS] ## IRC ## DoNumeric(%d)\n",num
));
861 // Process IRC commands given by numeric value ....
865 case 001: /* RPL_WELCOME */
866 case 002: /* RPL_YOURHOST */
867 case 003: /* RPL_CREATED */
868 case 004: /* RPL_MYINFO */
871 // Show Server connection messages on server log window
872 // * raw buff should be longer than the string we need since it contains the original unparsed vers
874 if (currentConnection
->connection_unprocessed
) sprintf( currentConnection
->connection_unprocessed
, "%s *** %s", currentConnection
->connection_serv_ARGS
[0], currentConnection
->connection_serv_ARGS
[3] );
876 return aircos_IRC_nop(currentConnection
);
879 case 332: /* RPL_TOPIC */
881 //Do chan connection topic
882 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
884 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[3])))
887 D(bug("[AiRcOS](numeric;initialtopic) Changing topic display\n"));
889 char *tmptopic
= AllocVec(strlen(currentConnection
->connection_serv_ARGS
[4]) + strlen(thisChanPriv
->chan_name
)+4, MEMF_CLEAR
);
891 sprintf(tmptopic
, "%s: %s", thisChanPriv
->chan_name
, currentConnection
->connection_serv_ARGS
[4]);
892 set(thisChanPriv
->chan_topic_obj
, MUIA_Text_Contents
, tmptopic
);
893 if (thisChanPriv
->chan_topic
) FreeVec(thisChanPriv
->chan_topic
);
894 thisChanPriv
->chan_topic
= tmptopic
;
896 /* Output confirmation of the initial channel topic */
898 struct serv_Outline
*sa
;
900 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
902 D(bug("[AiRcOS](numeric;initialtopic) Displaying Message in local channel\n"));
903 sa
->so_name
= AllocVec(strlen( currentConnection
->connection_serv_ARGS
[4] ) + strlen(_(MSG_INITIAL_TOPIC
)) + 1, MEMF_CLEAR
|MEMF_PUBLIC
);
904 sprintf( sa
->so_name
, _(MSG_INITIAL_TOPIC
), currentConnection
->connection_serv_ARGS
[4] );
906 aircosApp_setChanPen(thisChanPriv
, 4);
907 aircosApp_showChanOutput(thisChanPriv
,sa
);
908 aircosApp_setChanPen(thisChanPriv
, 0);
915 case 375: /* RPL_MOTDSTART */
916 case 372: /* RPL_MOTD */
917 case 376: /* RPL_ENDOFMOTD */
919 // Show MOTD messages on server log window
920 // * raw buff should be longer than the string we need since it contains the original unparsed vers
922 if (currentConnection
->connection_unprocessed
) sprintf( currentConnection
->connection_unprocessed
, "%s *** %s", currentConnection
->connection_serv_ARGS
[0], currentConnection
->connection_serv_ARGS
[3] );
924 return aircos_IRC_nop(currentConnection
);
927 case 351: /* RPL_WHOREPLY */
928 // ## UNHANDLED NUMERIC FUNC
931 case 352: /* RPL_WHOREPLY */
932 // ## UNHANDLED NUMERIC FUNC
934 // arg = currentConnection->connection_serv_ARGS[3]
935 // username = currentConnection->connection_serv_ARGS[4]
936 // host = currentConnection->connection_serv_ARGS[5]
937 // arg = currentConnection->connection_serv_ARGS[7]
938 // arg = currentConnection->connection_serv_ARGS[8]
941 case 353: /* RPL_NAMEREPLY */
943 // Process the channel user list ...
944 struct IRC_Channel_Priv
*thisChanPriv
= NULL
;
945 D(bug("[AiRcOS](numeric) Parsing userlist ..\n"));
946 if ((thisChanPriv
= FindNamedChannel(currentConnection
, currentConnection
->connection_serv_ARGS
[4])))
948 D(bug("[AiRcOS](numeric;userlist) Found channel record for '%s'\n", currentConnection
->connection_serv_ARGS
[4]));
949 char *userlist
= currentConnection
->connection_serv_ARGS
[5];
950 int userlist_len
= strlen(userlist
),
955 D(bug("[AiRcOS](numeric;userlist) Processing userlist [%d]'%s' ..\n", userlist_len
, userlist
));
956 for (i
= 0; i
< (userlist_len
+ 1); i
++)
958 if (((userlist
[i
] == ' ')||(i
== userlist_len
))&&( namestart
< (userlist_len
-1) ))
961 D(bug("[AiRcOS](numeric;userlist) Adding user %d '%s' [start %d, end %d]\n",usercount
, &userlist
[namestart
], namestart
, i
));
963 if (userlist
[namestart
] == '@') aircos_Add_ChannelUser( thisChanPriv
, (char *)_(MSG_ADMINS
), &userlist
[namestart
+1]);
964 else if (userlist
[namestart
] == '+') aircos_Add_ChannelUser( thisChanPriv
, (char *)_(MSG_VOICE
), &userlist
[namestart
+1]);
965 else aircos_Add_ChannelUser( thisChanPriv
, (char *)_(MSG_NORMAL
), &userlist
[namestart
]);
975 case 311: /* RPL_WHOISUSER */
976 // ## UNHANDLED NUMERIC FUNC
978 // nick = currentConnection->connection_serv_ARGS[3]
979 // username = currentConnection->connection_serv_ARGS[4]
980 // @domain = currentConnection->connection_serv_ARGS[5]
982 // format nick = username@domain
985 case 324: /* RPL_CHANNELMODEIS */
986 // ## UNHANDLED NUMERIC FUNC
988 // channel = currentConnection->connection_serv_ARGS[3]
989 // mode = currentConnection->connection_serv_ARGS[4]
994 // ## UNHANDLED NUMERIC FUNC
995 // Channel created info?
999 // ## UNHANDLED NUMERIC FUNC
1003 case 317: /* RPL_WHOISIDLE */
1004 // ## UNHANDLED NUMERIC FUNC
1007 case 432: /* ERR_ERRONEUSNICKNAME */
1008 case 433: /* ERR_NICKNAMEINUSE */
1009 // ## UNHANDLED NUMERIC FUNC
1018 /** CLIENT SIDE COMMANDS (SENDING) **/
1021 static int aircos_CLIENT_nop(struct IRC_Channel_Priv
*sendOnThisChannel
)
1023 struct serv_Outline
*sa
;
1025 D(bug("[AiRcOS] ## CLIENT ## NOP('%s')\n",sendOnThisChannel
->chan_send_ARGS
[0]));
1027 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
1029 sa
->so_name
= AllocVec(strlen( sendOnThisChannel
->chan_send_ARGS
[0] ) + strlen(_(MSG_UNHANDLED_COMMAND
)) + 1, MEMF_CLEAR
|MEMF_PUBLIC
);
1030 sprintf( sa
->so_name
, _(MSG_UNHANDLED_COMMAND
), sendOnThisChannel
->chan_send_ARGS
[0] );
1032 aircosApp_setChanPen(sendOnThisChannel
, 8);
1033 aircosApp_showChanOutput(sendOnThisChannel
,sa
);
1034 aircosApp_setChanPen(sendOnThisChannel
, 0);
1040 static int aircos_CLIENT_doSingleArg(struct IRC_Channel_Priv
*sendOnThisChannel
)
1042 D(bug("[AiRcOS] ## CLIENT ## DoSingleArg(Action:'%s', Arg:'",sendOnThisChannel
->chan_send_ARGS
[0]));
1043 int action_argcount
= 1;
1046 while (sendOnThisChannel
->chan_send_ARGS
[action_argcount
] != NULL
)
1048 D(bug(" %s",sendOnThisChannel
->chan_send_ARGS
[action_argcount
]));
1050 *(sendOnThisChannel
->chan_send_ARGS
[action_argcount
]-1) = ' ';
1054 sprintf(sendOnThisChannel
->chan_serv
->serv_connection
->connection_buff_send
, "%s %s\n\r", sendOnThisChannel
->chan_send_ARGS
[0], sendOnThisChannel
->chan_send_ARGS
[1]);
1056 aircosApp_sendline(sendOnThisChannel
->chan_serv
->serv_connection
);
1061 static int aircos_CLIENT_doMe(struct IRC_Channel_Priv
*sendOnThisChannel
)
1063 D(bug("[AiRcOS] ## CLIENT ## DoMe('"));
1064 int action_argcount
= 1;
1067 while (sendOnThisChannel
->chan_send_ARGS
[action_argcount
] != NULL
)
1069 D(bug(" %s",sendOnThisChannel
->chan_send_ARGS
[action_argcount
]));
1071 *(sendOnThisChannel
->chan_send_ARGS
[action_argcount
]-1) = ' ';
1075 sprintf(sendOnThisChannel
->chan_serv
->serv_connection
->connection_buff_send
, "PRIVMSG %s :\1ACTION %s\1\n\r", sendOnThisChannel
->chan_name
, sendOnThisChannel
->chan_send_ARGS
[1]);
1077 aircosApp_sendline(sendOnThisChannel
->chan_serv
->serv_connection
);
1079 struct serv_Outline
*sa
;
1081 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
1083 D(bug("[AiRcOS](client;dome) Displaying local Message\n"));
1084 sa
->so_name
= AllocVec(strlen( sendOnThisChannel
->chan_serv
->serv_connection
->connection_nick
) + strlen( sendOnThisChannel
->chan_send_ARGS
[1] ) + strlen("*** %s %s\n") + 1, MEMF_CLEAR
|MEMF_PUBLIC
);
1085 sprintf( sa
->so_name
, "*** %s %s\n", sendOnThisChannel
->chan_serv
->serv_connection
->connection_nick
, sendOnThisChannel
->chan_send_ARGS
[1] );
1087 aircosApp_setChanPen(sendOnThisChannel
, 8);
1088 aircosApp_showChanOutput(sendOnThisChannel
,sa
);
1089 aircosApp_setChanPen(sendOnThisChannel
, 0);
1094 struct functionrecord commandList_array
[]=
1096 {"ADMIN" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1097 {"AWAY" , aircos_IRC_nop
, 1 , aircos_CLIENT_nop
, 15 },
1098 {"CLOSE" , aircos_IRC_nop
, 15 , aircos_CLIENT_doSingleArg
, 15 },
1099 {"CONNECT" , aircos_IRC_nop
, 3 , aircos_CLIENT_nop
, 15 },
1100 {"DESCRIBE" , aircos_IRC_nop
, 2 , aircos_CLIENT_nop
, 15 },
1101 {"DIE" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1102 {"DNS" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1103 {"ERROR" , aircos_IRC_doerror
, 15 , aircos_CLIENT_nop
, 15 },
1104 {"HASH" , aircos_IRC_nop
, 1 , aircos_CLIENT_nop
, 15 },
1105 {"HELP" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1106 {"INFO" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1107 {"INVITE" , aircos_IRC_doinvite
, 15 , aircos_CLIENT_nop
, 15 },
1108 {"ISON" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1109 {"JOIN" , aircos_IRC_dojoin
, 15 , aircos_CLIENT_doSingleArg
, 15 },
1110 {"KICK" , aircos_IRC_dokick
, 3 , aircos_CLIENT_doSingleArg
, 15 },
1111 {"KILL" , aircos_IRC_dokill
, 2 , aircos_CLIENT_nop
, 15 },
1112 {"LEAVE" , aircos_IRC_nop
, 15 , aircos_CLIENT_doSingleArg
, 15 },
1113 {"LINKS" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1114 {"LIST" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1115 {"LUSERS" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1116 {"ME" , aircos_IRC_nop
, 1 , aircos_CLIENT_doMe
, 15 },
1117 {"MSG" , aircos_IRC_nop
, 2 , aircos_CLIENT_nop
, 15 },
1118 {"MOTD" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1119 {"MODE" , aircos_IRC_domode
, 15 , aircos_CLIENT_nop
, 15 },
1120 {"NAMES" , aircos_IRC_nop
, 1 , aircos_CLIENT_nop
, 15 },
1121 {"NICK" , aircos_IRC_donick
, 1 , aircos_CLIENT_doSingleArg
, 15 },
1122 {"NOTE" , aircos_IRC_nop
, 2 , aircos_CLIENT_nop
, 15 },
1123 {"NOTICE" , aircos_IRC_donotice
, 3 , aircos_CLIENT_nop
, 15 },
1124 {"OPER" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1125 {"PART" , aircos_IRC_dopart
, 15 , aircos_CLIENT_nop
, 15 },
1126 {"PASS" , aircos_IRC_nop
, 1 , aircos_CLIENT_nop
, 15 },
1127 {"PING" , aircos_IRC_nop
, 1 , aircos_CLIENT_nop
, 15 },
1128 {"PONG" , aircos_IRC_dopong
, 1 , aircos_CLIENT_nop
, 15 },
1129 {"PRIVMSG" , aircos_IRC_doprivmsg
, 2 , aircos_CLIENT_nop
, 15 },
1130 {"QUIT" , aircos_IRC_doquit
, 1 , aircos_CLIENT_doSingleArg
, 15 },
1131 {"REHASH" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1132 {"RESTART" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1133 {"SERVER" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1134 {"SQUIT" , aircos_IRC_nop
, 2 , aircos_CLIENT_nop
, 15 },
1135 {"STATS" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1136 {"SUMMON" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1137 {"TIME" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1138 {"TOPIC" , aircos_IRC_dotopic
, 2 , aircos_CLIENT_nop
, 15 },
1139 {"TRACE" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1140 {"USER" , aircos_IRC_nop
, 4 , aircos_CLIENT_nop
, 15 },
1141 {"USERHOST" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1142 {"USERS" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1143 {"VERSION" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1144 {"WALLOPS" , aircos_IRC_nop
, 1 , aircos_CLIENT_nop
, 15 },
1145 {"WHO" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1146 {"WHOIS" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1147 {"WHOWAS" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1148 {"IGNORE" , aircos_IRC_nop
, 1 , aircos_CLIENT_nop
, 15 },
1149 {"QUOTE" , aircos_IRC_nop
, 15 , aircos_CLIENT_nop
, 15 },
1150 {NULL
,NULL
,0,NULL
,0}
1153 /* ************** USER/GROUP MANAGEMENT FUNCTIONS *************** */
1155 struct IRC_Channel_Group_SubGroup
*aircos_Find_Group
1156 ( struct IRC_Channel_Priv
* searchChannel
, char * findThisGroup
)
1158 struct IRC_Channel_Group_SubGroup
*current_Group
=NULL
;
1159 ForeachNode(&searchChannel
->chan_usergroup
, current_Group
)
1161 if (strcasecmp(current_Group
->group_name
,findThisGroup
)==0) return current_Group
;
1167 struct IRC_Channel_Group_SubGroup
*aircos_Add_ChannelGroup
1168 ( struct IRC_Channel_Priv
* addToChannel
, char * addThisGroup
)
1170 struct IRC_Channel_Group_SubGroup
*current_Group
= NULL
;
1172 if (!(addThisGroup
)) addThisGroup
= "<DEFAULT>";
1174 if (!(current_Group
= aircos_Find_Group(addToChannel
,addThisGroup
)))
1176 if (!(current_Group
= AllocVec(sizeof(struct IRC_Channel_Group_SubGroup
), MEMF_CLEAR
)))
1178 D(bug("[AiRcOS](addgrp) Failed to allocate space for group record!!\n"));
1182 current_Group
->group_type
= CHANNEL_GROUPT_SUBGROUP
;
1183 if (!(current_Group
->group_name
= AllocVec(strlen(addThisGroup
) + 1, MEMF_CLEAR
)))
1185 D(bug("[AiRcOS](addgrp) Failed to allocate space for group name!!\n"));
1186 FreeVec(current_Group
);
1189 if (!(current_Group
->group_displayname
= AllocVec(strlen(addThisGroup
) + 3, MEMF_CLEAR
)))
1191 D(bug("[AiRcOS](addgrp) Failed to allocate space for group label!!\n"));
1192 FreeVec(current_Group
->group_name
);
1193 FreeVec(current_Group
);
1197 strcpy( current_Group
->group_name
, addThisGroup
);
1199 sprintf( current_Group
->group_displayname
, "\033b%s", current_Group
->group_name
);
1201 NewList((struct List
*)¤t_Group
->group_usergroup
);
1202 if (strcmp("<DEFAULT>",current_Group
->group_name
)!=0)
1204 current_Group
->group_userobj
= (struct MUI_NListtree_TreeNode
*)DoMethod( addToChannel
->chan_users
, MUIM_NListtree_Insert
, current_Group
->group_displayname
, (IPTR
)current_Group
, MUIV_NListtree_Insert_ListNode_Root
, MUIV_NListtree_Insert_PrevNode_Sorted
, TNF_LIST
| TNF_OPEN
, TAG_DONE
);
1205 D(bug("[AiRcOS](addgrp) NList item for group '%s' @ %x\n",current_Group
->group_name
,current_Group
->group_userobj
));
1209 D(bug("[AiRcOS](addgrp) SKIPPING NList item for group '%s'\n",current_Group
->group_name
));
1211 AddTail((struct List
*)&addToChannel
->chan_usergroup
, (struct Node
*)¤t_Group
->group_node
);
1214 return current_Group
;
1217 struct IRC_Channel_Group_User
*aircos_Find_User
1218 ( struct IRC_Channel_Priv
* searchChannel
, char * searchGroup
, char * findThisUser
)
1220 struct IRC_Channel_Group_User
*current_User
=NULL
;
1221 struct IRC_Channel_Group_SubGroup
*current_Group
=NULL
;
1223 if (!(searchGroup
)) searchGroup
= "<DEFAULT>";
1225 if ((current_Group
= aircos_Find_Group(searchChannel
,searchGroup
)))
1227 ForeachNode(¤t_Group
->group_usergroup
, current_User
)
1229 if (strcasecmp(current_User
->user_name
,findThisUser
)==0) return current_User
;
1236 struct IRC_Channel_Group_User
*aircos_Add_ChannelUser( struct IRC_Channel_Priv
* addToChannel
, char * addToThisGroup
, char * addThisUser
)
1238 struct IRC_Channel_Group_SubGroup
*current_Group
= NULL
;
1239 struct IRC_Channel_Group_User
*current_User
= NULL
;
1241 if (!(addToThisGroup
)) addToThisGroup
= "<DEFAULT>";
1243 D(bug("[AiRcOS](adduser) Looking for users channel record '%s'\n",addToThisGroup
));
1245 if (!(current_Group
= aircos_Find_Group(addToChannel
,addToThisGroup
)))
1247 if(!(current_Group
= aircos_Add_ChannelGroup(addToChannel
,addToThisGroup
)))
1249 D(bug("[AiRcOS](adduser) Failed to find or create a record for group '%s'\n",addToThisGroup
));
1254 D(bug("[AiRcOS](adduser) Looking for exisiting user record for '%s' in group '%s'\n",addThisUser
, current_Group
->group_name
));
1256 if (!(current_User
= aircos_Find_User(addToChannel
,addToThisGroup
,addThisUser
)))
1258 D(bug("[AiRcOS](adduser) no record for '%s' found\n",addThisUser
));
1259 if ((current_User
= AllocVec(sizeof(struct IRC_Channel_Group_User
), MEMF_CLEAR
)))
1261 current_User
->group_type
= CHANNEL_GROUPT_USER
;
1262 if (!(current_User
->user_name
= AllocVec(strlen(addThisUser
)+1,MEMF_CLEAR
)))
1264 D(bug("[AiRcOS](adduser) Failed to allocate space to store user name!!\n"));
1265 FreeVec(current_User
);
1270 if (!(current_User
->user_displayname
= AllocVec(strlen(addThisUser
)+3,MEMF_CLEAR
)))
1272 D(bug("[AiRcOS](adduser) Failed to allocate space to store user label!!\n"));
1273 FreeVec(current_User
);
1277 strcpy( current_User
->user_name
, addThisUser
);
1278 sprintf( current_User
->user_displayname
, " %s" , current_User
->user_name
);
1280 if (!(current_Group
->group_userobj
))
1282 D(bug("[AiRcOS](addUser) Users group has no object..\n"));
1286 if (strcmp("<DEFAULT>", current_Group
->group_name
) == 0)
1288 current_User
->user_obj
= (struct MUI_NListtree_TreeNode
*)DoMethod( addToChannel
->chan_users
, MUIM_NListtree_Insert
, current_User
->user_displayname
, current_User
, MUIV_NListtree_Insert_ListNode_Root
, MUIV_NListtree_Insert_PrevNode_Sorted
, 0x8000, TAG_DONE
);
1289 D(bug("[AiRcOS](adduser) Adding NList item for user '%s' to ROOT node\n",current_User
->user_name
));
1293 current_User
->user_obj
= (struct MUI_NListtree_TreeNode
*)DoMethod( addToChannel
->chan_users
, MUIM_NListtree_Insert
, current_User
->user_displayname
, current_User
, current_Group
->group_userobj
, MUIV_NListtree_Insert_PrevNode_Sorted
, 0x8000, TAG_DONE
);
1294 D(bug("[AiRcOS](adduser) Adding NList item for user '%s' to group node\n",current_User
->user_name
));
1297 AddTail((struct List
*)¤t_Group
->group_usergroup
, (struct Node
*)¤t_User
->group_node
);
1302 D(bug("[AiRcOS](adduser) Failed to allocate user record!!\n"));
1307 D(bug("[AiRcOS](adduser) User record already exists\n"));
1310 return current_User
;
1313 /* ************** SERVER MANAGEMENT FUNCTIONS *************** */
1315 struct IRC_Server_Priv
*aircos_add_server(char *addserv
)
1317 struct IRC_Server_Priv
*new_ircServer
=NULL
;
1318 Object
*new_butt
= NULL
;
1320 D(bug("[AiRcOS] aircos_add_server(%s)\n",addserv
));
1322 if (!(new_ircServer
= AllocVec(sizeof(struct IRC_Server_Priv
)+strlen(addserv
)+1, MEMF_CLEAR
))) return NULL
;
1323 char *tmp_str
= (char *)&new_ircServer
[1];
1324 CopyMem(addserv
,tmp_str
,strlen(addserv
));
1325 tmp_str
[strlen(addserv
)] = '\0';
1327 NewList((struct List
*)&new_ircServer
->serv_chans
);
1329 new_ircServer
->serv_name
= tmp_str
;
1331 D(bug("[AiRcOS](addserv) ## allocated private record for %s\n",new_ircServer
->serv_name
));
1334 /* Object * servout_tmp = NListviewObject,
1335 MUIA_Listview_List, (IPTR) (new_ircServer->serv_status_output = NListObject,
1337 MUIA_NList_ListBackground, MUII_SHINE,
1338 MUIA_NList_MinLineHeight, 18,
1343 Object
* tmp_ScrollBar
= ScrollbarObject
, End
;
1345 new_ircServer
->serv_status_output
= NewObject(AiRcOS_Base
->editor_mcc
->mcc_Class
, NULL
,
1346 MUIA_TextEditor_Slider
, tmp_ScrollBar
,
1347 MUIA_Background
, MUII_SHINE
,
1348 MUIA_TextEditor_ColorMap
, AiRcOS_Base
->editor_cmap
,
1349 MUIA_TextEditor_ReadOnly
, TRUE
);
1351 if (!(new_ircServer
->serv_status_output
)) goto newircs_err1
;
1353 new_ircServer
->serv_send
= HGroup
,
1355 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1357 MUIA_Background
, MUII_ButtonBack
,
1361 Child
, (IPTR
) LLabel(_(MSG_SEND
)),
1367 new_ircServer
->serv_statuspage
= VGroup
,
1369 Child
, (IPTR
)new_ircServer
->serv_status_output
,
1370 Child
, (IPTR
)tmp_ScrollBar
,
1372 Child
, (IPTR
) HGroup
,
1373 MUIA_Group_SameWidth
, FALSE
,
1375 Child
, (IPTR
)( new_ircServer
->serv_message
= NewObject(AiRcOS_Base
->editor_mcc
->mcc_Class
, NULL
,
1376 MUIA_CustTextEditor_ServerPrivate
, (IPTR
)new_ircServer
,
1377 MUIA_Background
, MUII_SHINE
,
1378 MUIA_TextEditor_ColorMap
, AiRcOS_Base
->editor_cmap
)),
1379 Child
, (IPTR
)new_ircServer
->serv_send
,
1383 if (!(new_ircServer
->serv_statuspage
)) goto newircs_err2
;
1385 new_ircServer
->serv_pagemd_grp
= VGroup
,
1386 MUIA_Group_PageMode
, TRUE
,
1387 Child
, (IPTR
) new_ircServer
->serv_statuspage
,
1390 if (!(new_ircServer
->serv_pagemd_grp
)) goto newircs_err3
;
1392 Object
* tmp_servlog
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel(_(MSG_SERVER_LOG
)), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
;
1394 new_ircServer
->serv_page
= VGroup
,
1395 Child
, (IPTR
) (new_ircServer
->serv_page_reg_grp
= HGroup
,
1396 Child
, (IPTR
) tmp_servlog
,
1397 Child
, (IPTR
) (new_ircServer
->serv_page_reg_spcr
= RectangleObject
, MUIA_Background
, MUII_SHADOWFILL
,
1400 Child
, (IPTR
) HGroup
,
1401 Child
, (IPTR
) new_ircServer
->serv_pagemd_grp
,
1405 if (!(new_ircServer
->serv_page
)) goto newircs_err4
;
1407 D(bug("[AiRcOS](addserv) server page created\n"));
1409 if (AiRcOS_Base
->aircos_serv_no
!=0)
1411 D(bug("[AiRcOS](addserv) Adding Server Button to existing server group\n"));
1412 /* Add the new server to our existing group */
1414 new_butt
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel(new_ircServer
->serv_name
), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
;
1416 if (DoMethod(AiRcOS_Base
->aircos_window_pagemd_reg_grp
, MUIM_Group_InitChange
))
1418 DoMethod(AiRcOS_Base
->aircos_window_pagemd_reg_grp
, OM_REMMEMBER
, AiRcOS_Base
->aircos_window_pagemd_reg_spcr
);
1420 DoMethod(AiRcOS_Base
->aircos_window_pagemd_reg_grp
, OM_ADDMEMBER
, new_butt
);
1421 DoMethod(AiRcOS_Base
->aircos_window_pagemd_reg_grp
, OM_ADDMEMBER
, AiRcOS_Base
->aircos_window_pagemd_reg_spcr
);
1423 DoMethod(AiRcOS_Base
->aircos_window_pagemd_reg_grp
, MUIM_Group_ExitChange
);
1426 D(bug("[AiRcOS](addserv) Adding page to existing server page group\n"));
1427 /* Add the new server to our existing group */
1428 if (DoMethod(AiRcOS_Base
->aircos_window_pagemd_grp
, MUIM_Group_InitChange
))
1430 DoMethod(AiRcOS_Base
->aircos_window_pagemd_grp
, OM_ADDMEMBER
, new_ircServer
->serv_page
);
1432 DoMethod(AiRcOS_Base
->aircos_window_pagemd_grp
, MUIM_Group_ExitChange
);
1435 set(AiRcOS_Base
->aircos_window_pagemd_grp
,MUIA_Group_ActivePage
,MUIV_Group_ActivePage_Last
);
1439 D(bug("[AiRcOS](addserv) Creating new server page group\n"));
1440 /* Add The first Server and remove our spacer */
1441 Object
*old_root
= AiRcOS_Base
->aircos_window_page
;
1443 AiRcOS_Base
->aircos_window_pagemd_grp
= VGroup
,
1444 MUIA_Group_PageMode
, TRUE
,
1446 Child
, (IPTR
) new_ircServer
->serv_page
,
1449 AiRcOS_Base
->aircos_window_page
= VGroup
,
1450 Child
, (IPTR
) (AiRcOS_Base
->aircos_window_pagemd_reg_grp
= HGroup
,
1451 Child
, (IPTR
)(new_butt
= HGroup
,
1453 MUIA_Background
, PAGE_BUT_BACK
,
1454 Child
, (IPTR
) LLabel( new_ircServer
->serv_name
),
1455 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1457 Child
, (IPTR
) (AiRcOS_Base
->aircos_window_pagemd_reg_spcr
= RectangleObject
,
1458 MUIA_Background
, MUII_SHADOWFILL
,
1461 Child
, (IPTR
) AiRcOS_Base
->aircos_window_pagemd_grp
,
1464 if (DoMethod(AiRcOS_Base
->aircos_window_content
, MUIM_Group_InitChange
))
1466 DoMethod(AiRcOS_Base
->aircos_window_content
, OM_ADDMEMBER
, AiRcOS_Base
->aircos_window_page
);
1467 DoMethod(AiRcOS_Base
->aircos_window_content
, OM_REMMEMBER
, old_root
);
1469 DoMethod(AiRcOS_Base
->aircos_window_content
, MUIM_Group_ExitChange
);
1474 new_ircServer
->serv_pageid
= AiRcOS_Base
->aircos_serv_no
++;
1477 new_butt
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
1478 (IPTR
) AiRcOS_Base
->aircos_window_pagemd_grp
, 3, MUIM_Set
, MUIA_Group_ActivePage
, new_ircServer
->serv_pageid
1483 tmp_servlog
, MUIM_Notify
, MUIA_Selected
, FALSE
,
1484 (IPTR
) AiRcOS_Base
->aircos_clientwin
, 3, MUIM_Set
, MUIA_Window_DefaultObject
, new_ircServer
->serv_message
1489 tmp_servlog
, MUIM_Notify
, MUIA_Selected
, FALSE
,
1490 (IPTR
) AiRcOS_Base
->aircos_clientwin
, 3, MUIM_Set
, MUIA_Window_ActiveObject
, new_ircServer
->serv_message
1493 D(bug("[AiRcOS](addserv) Set NOTIFICATION for SERVER page '%s' [ID:%d]\n", new_ircServer
->serv_name
, new_ircServer
->serv_pageid
));
1496 tmp_servlog
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
1497 (IPTR
) new_ircServer
->serv_pagemd_grp
, 3, MUIM_Set
, MUIA_Group_ActivePage
, 0
1499 D(bug("[AiRcOS](addserv) Set NOTIFICATION for 'Server Log' button [ID:%d]\n", new_ircServer
->serv_name
, 0));
1500 AddTail((struct List
*)&AiRcOS_Base
->aircos_serverlist
,(struct Node
*) &new_ircServer
->serv_node
);
1502 set( AiRcOS_Base
->aircos_clientwin
, MUIA_Window_DefaultObject
, new_ircServer
->serv_message
);
1503 set( AiRcOS_Base
->aircos_clientwin
, MUIA_Window_ActiveObject
, new_ircServer
->serv_message
);
1505 return new_ircServer
;
1509 MUI_DisposeObject(new_ircServer
->serv_pagemd_grp
);
1514 MUI_DisposeObject(new_ircServer
->serv_statuspage
);
1519 MUI_DisposeObject(new_ircServer
->serv_status_output
);
1524 FreeVec(new_ircServer
);
1528 /* returns our private structure for a named server, or null if not found */
1530 struct IRC_Server_Priv
*aircos_find_server(char *find_server_name
)
1532 struct IRC_Server_Priv
*cur_server
=NULL
;
1534 D(bug("[AiRcOS] findServer('%s')\n", find_server_name
));
1536 ForeachNode(&AiRcOS_Base
->aircos_serverlist
, cur_server
)
1538 D(bug("[AiRcOS](findserver) checking '%s'\n", cur_server
->serv_name
));
1539 if (strcasecmp(cur_server
->serv_name
,find_server_name
)==0) return cur_server
;
1546 /* destroy the zune data and private records for the named server */
1548 BOOL
aircos_rem_server(char *remserv
)
1550 struct IRC_Server_Priv
*rem_this_serv
;
1552 D(bug("[AiRcOS] aircos_rem_server('%s')\n", remserv
));
1554 if (!(rem_this_serv
= aircos_find_server(remserv
)))
1559 AiRcOS_Base
->aircos_serv_no
--;
1561 if (AiRcOS_Base
->aircos_serv_no
!=0)
1563 /* remove the page from the server group */
1564 if (DoMethod(AiRcOS_Base
->aircos_window_pagemd_grp
, MUIM_Group_InitChange
))
1566 DoMethod(AiRcOS_Base
->aircos_window_pagemd_grp
, OM_REMMEMBER
, rem_this_serv
);
1568 DoMethod(AiRcOS_Base
->aircos_window_pagemd_grp
, MUIM_Group_ExitChange
);
1573 Object
*old_root
= AiRcOS_Base
->aircos_window_pagemd_grp
;
1574 AiRcOS_Base
->aircos_window_pagemd_grp
= VGroup
,
1576 MUIA_Background
, MUII_SHADOWFILL
,
1577 Child
, RectangleObject
,
1580 /* and remove the old object */
1581 if (DoMethod(AiRcOS_Base
->aircos_window_content
, MUIM_Group_InitChange
))
1583 DoMethod(AiRcOS_Base
->aircos_window_content
, OM_ADDMEMBER
, AiRcOS_Base
->aircos_window_pagemd_grp
);
1584 DoMethod(AiRcOS_Base
->aircos_window_content
, OM_REMMEMBER
, old_root
);
1586 DoMethod(AiRcOS_Base
->aircos_window_content
, MUIM_Group_ExitChange
);
1589 FreeVec(rem_this_serv
);
1594 AROS_UFH3(void, parseoutput_func
,
1595 AROS_UFHA(struct Hook
*, unused_hook
, A0
),
1596 AROS_UFHA(APTR
, obj
, A2
),
1597 AROS_UFHA(struct IRC_Channel_Priv
*, hook_channel_arg
, A1
))
1601 struct IRC_Channel_Priv
*sendOnThisChannel
= unused_hook
->h_Data
;
1602 char *rawoutput
= NULL
;
1605 rawoutput
= (char *)DoMethod( obj
, MUIM_TextEditor_ExportText
);
1607 D(bug("[AiRcOS](parseoutput_func) Parse output for channel '%s' [%x:'%s']\n", sendOnThisChannel
->chan_name
, rawoutput
, rawoutput
));
1609 if (rawoutput
[0] == 0) return;
1611 if (!(rawoutput
[0] == '/'))
1613 /* Handle plain message sending (quick send) */
1614 D(bug("[AiRcOS](parseoutput_func) Sending plain message ..\n"));
1615 sprintf(sendOnThisChannel
->chan_serv
->serv_connection
->connection_buff_send
, "PRIVMSG %s :%s\n\r", sendOnThisChannel
->chan_name
, rawoutput
);
1617 aircosApp_sendline(sendOnThisChannel
->chan_serv
->serv_connection
);
1619 /* Display our sent message in our output window also.. */
1620 struct serv_Outline
*sa
;
1622 if (( sa
= (struct serv_Outline
*)AllocVec( sizeof( struct serv_Outline
), MEMF_CLEAR
) ))
1624 D(bug("[AiRcOS](parseoutput_func) Displaying Message localy\n"));
1625 sa
->so_name
= AllocVec(strlen( sendOnThisChannel
->chan_serv
->serv_connection
->connection_nick
) + strlen( rawoutput
) + strlen("<%s> %s\n") + 1, MEMF_CLEAR
|MEMF_PUBLIC
);
1626 sprintf( sa
->so_name
, "<%s> %s\n", sendOnThisChannel
->chan_serv
->serv_connection
->connection_nick
, rawoutput
);
1628 // sa->flags = (UWORD)msg->UserData;
1630 aircosApp_showChanOutput(sendOnThisChannel
,sa
);
1635 /* Handle command sending */
1636 D(bug("[AiRcOS](parseoutput_func) Handle command message ..\n"));
1638 sendOnThisChannel
->chan_send_ARGS
[pos
] = &rawoutput
[1];
1640 /* Seperate the server string into seperate args .. */
1641 while (sendOnThisChannel
->chan_send_ARGS
[pos
] != NULL
&& pos
< MAX_SEND_ARGS
)
1643 if ((AiRcOS_Base
->Ai_tmp
= strchr(sendOnThisChannel
->chan_send_ARGS
[pos
], ' ')))
1645 sendOnThisChannel
->chan_send_ARGS
[++pos
] = &AiRcOS_Base
->Ai_tmp
[1];
1646 *AiRcOS_Base
->Ai_tmp
= '\0';
1648 else sendOnThisChannel
->chan_send_ARGS
[++pos
] = NULL
;
1650 D(bug("[AiRcOS](parseoutput_func) Parsed %d args\n",pos
));
1652 sendOnThisChannel
->chan_send_ARGS
[++pos
] = NULL
;
1655 D(bug("[AiRcOS](parseoutput_func) ARGS :"));
1656 int debug_args_count
;
1657 for (debug_args_count
= 0; debug_args_count
<= pos
; debug_args_count
++)
1659 D(bug(" %d:'%s'",debug_args_count
,sendOnThisChannel
->chan_send_ARGS
[debug_args_count
]));
1664 for (pos
= 0; commandList_array
[pos
].command
!=NULL
&& !found
; pos
++) found
= (strcasecmp(commandList_array
[pos
].command
, sendOnThisChannel
->chan_send_ARGS
[0]) == 0);
1668 D(bug("[AiRcOS](parseoutput_func) Calling IRC funtion %d\n", pos
-1));
1669 pos
= (*commandList_array
[pos
-1].command_clientFunction
)(sendOnThisChannel
);
1673 DoMethod(obj
, MUIM_TextEditor_ClearText
); /* Clear the current buffer */
1676 D(bug("[AiRcOS](parseoutput_func) Freeing rawouput @ %x\n", rawoutput
));
1681 /* ************** CHANNEL MANAGEMENT FUNCTIONS *************** */
1683 struct IRC_Channel_Priv
*aircos_add_channel(char *addtoserv
,char *addchann
)
1685 Object
*img_user
= NULL
,
1688 *gad_font_col
= NULL
,
1689 *gad_font_back
= NULL
,
1690 *gad_font_s_s
= NULL
,
1691 *gad_font_s_d
= NULL
,
1692 *gad_font_s_l
= NULL
,
1693 *gad_font_bold
= NULL
,
1694 *gad_font_ital
= NULL
,
1695 *gad_font_under
= NULL
,
1696 *gad_pop_url
= NULL
,
1697 *gad_Pop_smiley
= NULL
,
1698 *gad_close_irc_out
= NULL
,
1699 *gad_close_userlist
= NULL
;
1701 struct IRC_Channel_Priv
*new_ircChannel
=NULL
;
1702 if (!(new_ircChannel
= (struct IRC_Channel_Priv
*)AllocVec(sizeof(struct IRC_Channel_Priv
) + strlen(addchann
) + 1, MEMF_CLEAR
))) return NULL
;
1704 char *tmp_str
= (char *)&new_ircChannel
[1];
1705 CopyMem(addchann
,tmp_str
,strlen(addchann
));
1706 tmp_str
[strlen(addchann
)] = '\0';
1708 D(bug("[AiRcOS] aircos_add_channel('%s' to '%s')\n", addchann
, addtoserv
));
1710 if (!(new_ircChannel
->chan_serv
= aircos_find_server(addtoserv
)))
1712 D(bug("[AiRcOS] Failed to locate server record for '%s'..\n", addtoserv
));
1713 FreeVec(new_ircChannel
);
1717 new_ircChannel
->chan_name
= tmp_str
;
1718 NewList((struct List
*)&new_ircChannel
->chan_usergroup
); /* Prepare User List */
1720 D(bug("[AiRcOS](addchannel) ## allocated private record for %s\n",new_ircChannel
->chan_name
));
1722 aircos_Add_ChannelGroup(new_ircChannel
, NULL
); /* Add the Base "Users" Group */
1724 /* Create the buttons */
1726 new_ircChannel
->chan_send
= HGroup
,
1728 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1730 MUIA_Background
, MUII_ButtonBack
,
1734 Child
, (IPTR
) LLabel(_(MSG_SEND
)),
1740 gad_close_irc_out
= HGroup
, MUIA_Weight
, 0, Child
, (IPTR
) LLabel(_(MSG_CLOSE_IRC
)), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
;
1741 gad_close_userlist
= HGroup
, MUIA_Weight
, 0, Child
, (IPTR
) LLabel(_(MSG_CLOSE_USERLIST
)), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
;
1743 /* Create the image objects */
1745 if (AiRcOS_Base
->aircos_got_speekimg
)
1747 img_speek
= ImageObject
,
1748 MUIA_Frame
, MUIV_Frame_None
,
1749 MUIA_ShowSelState
, FALSE
,
1750 MUIA_Image_Spec
, (IPTR
)"3:"SPEEKTYPE_IMAGE
,
1753 else img_speek
= RectangleObject
,End
;
1755 if (AiRcOS_Base
->aircos_got_userimg
)
1757 img_user
= ImageObject
,
1758 MUIA_Frame
, MUIV_Frame_None
,
1759 MUIA_ShowSelState
, FALSE
,
1760 MUIA_Image_Spec
, (IPTR
)"3:"USERTYPE_IMAGE
,
1763 else img_user
= RectangleObject
,End
;
1767 if (AiRcOS_Base
->aircos_got_fontbaimg
)
1769 gad_font_back
= ImageObject
,
1770 MUIA_Frame
, MUIV_Frame_None
,
1771 MUIA_ShowSelState
, FALSE
,
1772 MUIA_Image_Spec
, (IPTR
)"3:"FONT_BACK_IMAGE
,
1773 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1776 else gad_font_back
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("F"), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
; /* background color */
1779 if (AiRcOS_Base
->aircos_got_fontboimg
)
1781 gad_font_bold
= ImageObject
,
1782 MUIA_Frame
, MUIV_Frame_None
,
1783 MUIA_ShowSelState
, FALSE
,
1784 MUIA_Image_Spec
, (IPTR
)"3:"FONT_BOLD_IMAGE
,
1785 MUIA_InputMode
, MUIV_InputMode_Toggle
,
1788 else gad_font_bold
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("B"), MUIA_InputMode
, MUIV_InputMode_Toggle
, End
; /* bold */
1791 if (AiRcOS_Base
->aircos_got_fontcoimg
)
1793 gad_font_col
= ImageObject
,
1794 MUIA_Frame
, MUIV_Frame_None
,
1795 MUIA_ShowSelState
, FALSE
,
1796 MUIA_Image_Spec
, (IPTR
)"3:"FONT_COLOR_IMAGE
,
1797 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1800 else gad_font_col
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("F"), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
; /* Font color */
1803 if (AiRcOS_Base
->aircos_got_fontdeimg
)
1805 gad_font_s_d
= ImageObject
,
1806 MUIA_Frame
, MUIV_Frame_None
,
1807 MUIA_ShowSelState
, FALSE
,
1808 MUIA_Image_Spec
, (IPTR
)"3:"FONT_DEF_IMAGE
,
1809 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1812 else gad_font_s_d
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("F"), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
; /* Font size def */
1815 if (AiRcOS_Base
->aircos_got_fontitimg
)
1817 gad_font_ital
= ImageObject
,
1818 MUIA_Frame
, MUIV_Frame_None
,
1819 MUIA_ShowSelState
, FALSE
,
1820 MUIA_Image_Spec
, (IPTR
)"3:"FONT_ITAL_IMAGE
,
1821 MUIA_InputMode
, MUIV_InputMode_Toggle
,
1824 else gad_font_ital
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("I"), MUIA_InputMode
, MUIV_InputMode_Toggle
, End
; /* italic */
1827 if (AiRcOS_Base
->aircos_got_fontlaimg
)
1829 gad_font_s_l
= ImageObject
,
1830 MUIA_Frame
, MUIV_Frame_None
,
1831 MUIA_ShowSelState
, FALSE
,
1832 MUIA_Image_Spec
, (IPTR
)"3:"FONT_LARGE_IMAGE
,
1833 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1836 else gad_font_s_l
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("F"), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
; /* Font size larger */
1839 if (AiRcOS_Base
->aircos_got_fontsmimg
)
1841 gad_font_s_s
= ImageObject
,
1842 MUIA_Frame
, MUIV_Frame_None
,
1843 MUIA_ShowSelState
, FALSE
,
1844 MUIA_Image_Spec
, (IPTR
)"3:"FONT_SMALL_IMAGE
,
1845 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1848 else gad_font_s_s
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("F"), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
; /* Font size smaller */
1851 if (AiRcOS_Base
->aircos_got_fontunimg
)
1853 gad_font_under
= ImageObject
,
1854 MUIA_Frame
, MUIV_Frame_None
,
1855 MUIA_ShowSelState
, FALSE
,
1856 MUIA_Image_Spec
, (IPTR
)"3:"FONT_UNDER_IMAGE
,
1857 MUIA_InputMode
, MUIV_InputMode_Toggle
,
1860 else gad_font_under
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("U"), MUIA_InputMode
, MUIV_InputMode_Toggle
, End
; /* underline */
1863 /* if (AiRcOS_Base->aircos_got_poppicimg)
1865 gad_Pop_pic = ImageObject,
1866 MUIA_Frame, MUIV_Frame_None,
1867 MUIA_ShowSelState, FALSE,
1868 MUIA_Image_Spec, (IPTR)"3:"POP_PIC_IMAGE,
1869 MUIA_InputMode, MUIV_InputMode_RelVerify,
1872 else gad_Pop_pic = HGroup, MUIA_Weight, 0, MUIA_Background, PAGE_BUT_BACK, Child, (IPTR) LLabel("P"), MUIA_InputMode, MUIV_InputMode_RelVerify, End;*/ /* picture! */
1874 if (AiRcOS_Base
->aircos_got_popsmiimg
)
1876 gad_Pop_smiley
= ImageObject
,
1877 MUIA_Frame
, MUIV_Frame_None
,
1878 MUIA_ShowSelState
, FALSE
,
1879 MUIA_Image_Spec
, (IPTR
)"3:"POP_SMILEY_IMAGE
,
1880 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1883 else gad_Pop_smiley
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("S"), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
; /* smilley! */
1886 if (AiRcOS_Base
->aircos_got_popurlimg
)
1888 gad_pop_url
= ImageObject
,
1889 MUIA_Frame
, MUIV_Frame_None
,
1890 MUIA_ShowSelState
, FALSE
,
1891 MUIA_Image_Spec
, (IPTR
)"3:"POP_URL_IMAGE
,
1892 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1895 else gad_pop_url
= HGroup
, MUIA_Weight
, 0, MUIA_Background
, PAGE_BUT_BACK
, Child
, (IPTR
) LLabel("A"), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
; /* URL */
1897 /* Create the user list object */
1899 new_ircChannel
->chan_users
= MUI_NewObject( MUIC_NListtree
,
1901 MUIA_NList_ListBackground
, MUII_SHINE
,
1902 MUIA_NList_MinLineHeight
, 18,
1903 MUIA_NListtree_ShowTree
, FALSE
,
1904 /* FIXME: doesn't exist anymore in current NList */
1905 /* MUIA_NListtree_NoRootTree, TRUE, */
1906 MUIA_NListtree_MultiSelect
, MUIV_NListtree_MultiSelect_Shifted
,
1907 MUIA_NListtree_DoubleClick
, MUIV_NListtree_DoubleClick_Tree
,
1908 MUIA_NListtree_EmptyNodes
, FALSE
,
1909 MUIA_NListtree_TreeColumn
, 0,
1910 MUIA_NListtree_DragDropSort
, TRUE
,
1911 MUIA_NListtree_Title
, FALSE
,
1912 MUIA_NListtree_Format
, ",",
1915 user_nodes
= MUI_NewObject( MUIC_NListview
,
1916 MUIA_HorizWeight
, 20,
1917 MUIA_ShortHelp
, __(MSG_USERS
),
1918 MUIA_NListview_NList
, (IPTR
) new_ircChannel
->chan_users
,
1922 /* Create the channels page objects */
1925 ULONG output_grp_txt_len
= strlen(new_ircChannel
->chan_serv
->serv_name
) + strlen(new_ircChannel
->chan_name
) + 10;
1927 new_ircChannel
->chan_topic
= AllocVec(strlen(new_ircChannel
->chan_name
) +1, MEMF_CLEAR
);
1928 char *output_grp_label
= AllocVec(output_grp_txt_len
, MEMF_CLEAR
);
1930 sprintf(output_grp_label
,_(MSG_FROM_TO
), new_ircChannel
->chan_serv
->serv_name
, new_ircChannel
->chan_name
);
1931 sprintf(new_ircChannel
->chan_topic
,"%s",new_ircChannel
->chan_name
);
1933 Object
* tmp_ScrollBar
= ScrollbarObject
, End
;
1935 new_ircChannel
->chan_page
= VGroup
,
1936 Child
, (IPTR
) HGroup
,
1937 MUIA_Group_SameWidth
, FALSE
,
1938 Child
, (IPTR
) LLabel(_(MSG_TOPIC
)),
1939 Child
, (IPTR
) ( new_ircChannel
->chan_topic_obj
= TextObject
,
1940 MUIA_Text_Contents
, new_ircChannel
->chan_topic
,
1944 Child
, (IPTR
) HGroup
,
1945 Child
, (IPTR
) ( new_ircChannel
->chan_output_grp
= VGroup
,
1946 MUIA_HorizWeight
, 80,
1948 MUIA_Group_SameWidth
, FALSE
,
1950 MUIA_Background
, MUII_SHINE
,
1951 Child
, (IPTR
) img_speek
,
1952 Child
, (IPTR
) ( new_ircChannel
->chan_output_grp_txt
= TextObject
,
1953 MUIA_Text_Contents
, output_grp_label
,
1956 Child
, (IPTR
) gad_close_irc_out
,
1960 Child
, ( new_ircChannel
->chan_output
= NewObject(AiRcOS_Base
->editor_mcc
->mcc_Class
, NULL
,
1961 MUIA_Background
, MUII_SHINE
,
1962 MUIA_TextEditor_Slider
, tmp_ScrollBar
,
1963 MUIA_TextEditor_ColorMap
, AiRcOS_Base
->editor_cmap
,
1964 MUIA_TextEditor_ReadOnly
, TRUE
)),
1965 Child
, (IPTR
) tmp_ScrollBar
,
1968 Child
, (IPTR
) BalanceObject
,
1971 Child
, (IPTR
) HGroup
,
1972 MUIA_Group_SameWidth
, FALSE
,
1975 Child
, (IPTR
) gad_font_col
, /* Font color */
1976 Child
, (IPTR
) gad_font_back
, /* background color */
1978 Child
, RectangleObject
,
1980 MUIA_Rectangle_VBar
, TRUE
,
1983 Child
, (IPTR
) gad_font_s_s
, /* Font size smaller */
1984 Child
, (IPTR
) gad_font_s_d
, /* Font size def */
1985 Child
, (IPTR
) gad_font_s_l
, /* Font size larger */
1987 Child
, RectangleObject
,
1989 MUIA_Rectangle_VBar
, TRUE
,
1992 Child
, (IPTR
) gad_font_bold
, /* bold */
1993 Child
, (IPTR
) gad_font_ital
, /* italic */
1994 Child
, (IPTR
) gad_font_under
, /* underline */
1996 Child
, RectangleObject
,
1998 MUIA_Rectangle_VBar
, TRUE
,
2001 Child
, (IPTR
) gad_pop_url
, /* URL */
2003 Child
, RectangleObject
,
2005 MUIA_Rectangle_VBar
, TRUE
,
2008 Child
, (IPTR
) gad_Pop_smiley
, /* smilley! */
2010 Child
, RectangleObject
,
2014 Child
, (IPTR
) HGroup
,
2015 MUIA_Group_SameWidth
, FALSE
,
2017 Child
, (IPTR
) ( new_ircChannel
->chan_message
= NewObject(AiRcOS_Base
->editor_mcc
->mcc_Class
, NULL
,
2018 MUIA_Background
, MUII_SHINE
,
2019 MUIA_CustTextEditor_ChannelPrivate
, (IPTR
)new_ircChannel
,
2020 MUIA_TextEditor_ColorMap
, AiRcOS_Base
->editor_cmap
)),
2021 Child
, (IPTR
)new_ircChannel
->chan_send
,
2024 Child
, (IPTR
)BalanceObject
,
2026 Child
, (IPTR
)( new_ircChannel
->chan_users_grp
= VGroup
,
2027 MUIA_HorizWeight
, 20,
2028 MUIA_Group_SameSize
, FALSE
,
2031 MUIA_Background
, MUII_FILL
,
2032 Child
, (IPTR
)img_user
,
2033 Child
, (IPTR
)LLabel(_(MSG_USERS
)),
2035 Child
, (IPTR
)gad_close_userlist
,
2037 Child
, (IPTR
)user_nodes
,
2042 new_ircChannel
->chan_serv
->serv_chan_no
++;
2043 new_ircChannel
->chan_pageid
= new_ircChannel
->chan_serv
->serv_chan_no
;
2044 AddTail((struct List
*)&new_ircChannel
->chan_serv
->serv_chans
,(struct Node
*)&new_ircChannel
->chan_node
);
2046 Object
*new_butt
= NULL
;
2048 D(bug("[AiRcOS](addchan) Adding Channel Button to existing channel group\n"));
2049 /* Add the new server to our existing group */
2051 new_butt
= HGroup
,MUIA_Weight
,0,MUIA_Background
,PAGE_BUT_BACK
, Child
, (IPTR
) LLabel(new_ircChannel
->chan_name
), MUIA_InputMode
, MUIV_InputMode_RelVerify
, End
;
2053 if (DoMethod(new_ircChannel
->chan_serv
->serv_page_reg_grp
, MUIM_Group_InitChange
))
2056 DoMethod(new_ircChannel
->chan_serv
->serv_page_reg_grp
, OM_REMMEMBER
, new_ircChannel
->chan_serv
->serv_page_reg_spcr
);
2058 DoMethod(new_ircChannel
->chan_serv
->serv_page_reg_grp
, OM_ADDMEMBER
, new_butt
);
2059 DoMethod(new_ircChannel
->chan_serv
->serv_page_reg_grp
, OM_ADDMEMBER
, new_ircChannel
->chan_serv
->serv_page_reg_spcr
);
2061 DoMethod(new_ircChannel
->chan_serv
->serv_page_reg_grp
, MUIM_Group_ExitChange
);
2064 if (DoMethod(new_ircChannel
->chan_serv
->serv_pagemd_grp
, MUIM_Group_InitChange
))
2066 DoMethod(new_ircChannel
->chan_serv
->serv_pagemd_grp
, OM_ADDMEMBER
, new_ircChannel
->chan_page
);
2068 DoMethod(new_ircChannel
->chan_serv
->serv_pagemd_grp
, MUIM_Group_ExitChange
);
2071 set(new_ircChannel
->chan_serv
->serv_pagemd_grp
,MUIA_Group_ActivePage
,MUIV_Group_ActivePage_Last
);
2073 D(bug("[AiRcOS](addchan) prepare send hook\n"));
2075 new_ircChannel
->chan_hook
.h_MinNode
.mln_Succ
= NULL
;
2076 new_ircChannel
->chan_hook
.h_MinNode
.mln_Pred
= NULL
;
2077 new_ircChannel
->chan_hook
.h_Entry
= HookEntry
;
2078 new_ircChannel
->chan_hook
.h_SubEntry
= (void *)parseoutput_func
;
2079 new_ircChannel
->chan_hook
.h_Data
= new_ircChannel
;
2081 D(bug("[AiRcOS](addchan) Setting channel page notifications\n"));
2085 gad_close_irc_out
, MUIM_Notify
, MUIA_Selected
, FALSE
,
2086 (IPTR
) new_ircChannel
->chan_output_grp
, 3, MUIM_Set
, MUIA_ShowMe
, FALSE
2091 gad_close_userlist
, MUIM_Notify
, MUIA_Selected
, FALSE
,
2092 (IPTR
) new_ircChannel
->chan_users_grp
, 3, MUIM_Set
, MUIA_ShowMe
, FALSE
2097 new_butt
, MUIM_Notify
, MUIA_Selected
, FALSE
,
2098 (IPTR
) new_ircChannel
->chan_serv
->serv_pagemd_grp
, 3, MUIM_Set
, MUIA_Group_ActivePage
, new_ircChannel
->chan_pageid
2103 new_ircChannel
->chan_message
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
2104 (IPTR
)new_ircChannel
->chan_message
, 3, MUIM_CallHook
, &new_ircChannel
->chan_hook
, new_ircChannel
2109 new_ircChannel
->chan_send
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
2110 (IPTR
)new_ircChannel
->chan_message
, 3, MUIM_CallHook
, &new_ircChannel
->chan_hook
, new_ircChannel
2113 /* Handle Text Formatting Control */
2114 /* # Handle Input String setting Formatting */
2117 new_ircChannel
->chan_message
, MUIM_Notify
, MUIA_TextEditor_StyleBold
, MUIV_EveryTime
,
2118 (IPTR
)gad_font_bold
, 3, MUIM_NoNotifySet
, MUIA_Selected
, MUIV_TriggerValue
2123 new_ircChannel
->chan_message
, MUIM_Notify
, MUIA_TextEditor_StyleItalic
, MUIV_EveryTime
,
2124 (IPTR
)gad_font_ital
, 3, MUIM_NoNotifySet
, MUIA_Selected
, MUIV_TriggerValue
2129 new_ircChannel
->chan_message
, MUIM_Notify
, MUIA_TextEditor_StyleUnderline
, MUIV_EveryTime
,
2130 (IPTR
)gad_font_under
, 3, MUIM_NoNotifySet
, MUIA_Selected
, MUIV_TriggerValue
2133 /* # Handle Gadgets setting Formatting */
2136 gad_font_bold
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
2137 (IPTR
)new_ircChannel
->chan_message
, 3, MUIM_NoNotifySet
, MUIA_TextEditor_StyleBold
, MUIV_TriggerValue
2142 gad_font_ital
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
2143 (IPTR
)new_ircChannel
->chan_message
, 3, MUIM_NoNotifySet
, MUIA_TextEditor_StyleItalic
, MUIV_TriggerValue
2148 gad_font_under
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
2149 (IPTR
)new_ircChannel
->chan_message
, 3, MUIM_NoNotifySet
, MUIA_TextEditor_StyleUnderline
, MUIV_TriggerValue
2154 new_butt
, MUIM_Notify
, MUIA_Selected
, FALSE
,
2155 (IPTR
) AiRcOS_Base
->aircos_clientwin
, 3, MUIM_Set
, MUIA_Window_DefaultObject
, new_ircChannel
->chan_message
2160 new_butt
, MUIM_Notify
, MUIA_Selected
, FALSE
,
2161 (IPTR
) AiRcOS_Base
->aircos_clientwin
, 3, MUIM_Set
, MUIA_Window_ActiveObject
, new_ircChannel
->chan_message
2164 set( AiRcOS_Base
->aircos_clientwin
, MUIA_Window_DefaultObject
, new_ircChannel
->chan_message
);
2165 set( AiRcOS_Base
->aircos_clientwin
, MUIA_Window_ActiveObject
, new_ircChannel
->chan_message
);
2167 D(bug("[AiRcOS](addchan) Set NOTIFICATION for channel page '%s' [ID:%d]\n", new_ircChannel
->chan_name
, new_ircChannel
->chan_pageid
));
2168 return new_ircChannel
;
2171 BOOL
aircos_rem_channel(char *remfromserv
, char *remchann
)
2173 D(bug("[AiRcOS](addchan) aircos_rem_channel('%s' from '%s')\n", remchann
, remfromserv
));