Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitchX
GitHub Repository: BitchX/BitchX1.3
Path: blob/master/dll/aim/bx.patch
1072 views
1
--- .//dll/fserv/fserv.c.orig Tue Jan 18 21:00:07 2000
2
+++ .//dll/fserv/fserv.c Tue Jan 18 21:00:19 2000
3
@@ -1162,7 +1162,7 @@
4
add_module_proc(HOOK_PROC, "Fserv", NULL, "*", MSG_LIST, 1, NULL, search_proc);
5
add_module_proc(HOOK_PROC, "Fserv", NULL, "*", PUBLIC_OTHER_LIST, 1, NULL, search_proc);
6
7
- add_completion_type("fsload", 3, FILE_COMPLETION);
8
+ add_completion_type("fsload", 3, FILE_COMPLETION,NULL);
9
10
add_timer(0, empty_string, get_dllint_var("fserv_time"), 1, impress_me, NULL, NULL, -1, "fserv");
11
strcpy(FSstr, cparse(FS, NULL, NULL));
12
@@ -1177,4 +1177,4 @@
13
put_it("%s for help with this fserv, /fshelp", FSstr);
14
return 0;
15
}
16
-
17
\ No newline at end of file
18
+
19
--- .//dll/nap/nap.c.orig Wed Jan 19 14:17:52 2000
20
+++ .//dll/nap/nap.c Tue Jan 18 21:01:34 2000
21
@@ -2139,8 +2139,8 @@
22
add_module_proc(VAR_PROC, nap_name, "napster_format", NULL, STR_TYPE_VAR, 0, set_numeric_string, NULL);
23
add_module_proc(VAR_PROC, nap_name, "napster_dir", NULL, STR_TYPE_VAR, 0, NULL, NULL);
24
25
- add_completion_type("nload", 4, FILE_COMPLETION);
26
- add_completion_type("nreload", 4, FILE_COMPLETION);
27
+ add_completion_type("nload", 4, FILE_COMPLETION,NULL);
28
+ add_completion_type("nreload", 4, FILE_COMPLETION,NULL);
29
30
naphelp(NULL, NULL, NULL, NULL, NULL);
31
sprintf(buffer, "$0+Napster %s by panasync - $2 $3", nap_version);
32
--- .//include/module.h.orig Tue Jan 18 01:24:49 2000
33
+++ .//include/module.h Tue Jan 18 20:29:36 2000
34
@@ -633,7 +633,14 @@
35
CHECK_EXT_MAIL,
36
DEFAULT_OUTPUT_FUNCTION,
37
DEFAULT_STATUS_OUTPUT_FUNCTION,
38
- NUMBER_OF_GLOBAL_FUNCTIONS
39
+ NUMBER_OF_GLOBAL_FUNCTIONS,
40
+
41
+/* window.c again */
42
+ WINDOW_QUERY,
43
+
44
+/* input.c again */
45
+
46
+ OVERWRITE_TABKEY_COMP
47
};
48
49
extern Function_ptr global_table[];
50
--- .//include/modval.h.orig Tue Jan 18 16:50:22 2000
51
+++ .//include/modval.h Tue Jan 18 20:28:58 2000
52
@@ -360,7 +360,8 @@
53
#define getnextnick(x, y, z, a) ((NickTab *) (global[GETNEXTNICK]((int)x, (char *)y, (char *)z, (char *)a)))
54
#define getchannick(x, y) ((char *) (global[GETCHANNICK]((char *)x, (char *)y)))
55
#define lookup_nickcompletion(x, y) ((NickList *) (global[LOOKUP_NICKCOMPLETION]((ChannelList *)x, (char *)y)))
56
-#define add_completion_type(x, y, z) ((int) (global[ADD_COMPLETION_TYPE]((char *)x, (int)y, (enum completion)z)))
57
+#define add_completion_type(x, y, z, a) ((int) (global[ADD_COMPLETION_TYPE]((char *)x, (int)y, (enum completion)z, a)))
58
+#define overwrite_tabkey_comp(a,b) (global[OVERWRITE_TABKEY_COMP](a,b))
59
60
/* names.c */
61
#define is_channel(x) ((int) (global[IS_CHANNEL]((char *)x)))
62
--- .//include/input.h.orig Tue Jan 18 16:23:49 2000
63
+++ .//include/input.h Thu Jan 20 17:05:28 2000
64
@@ -157,11 +157,15 @@
65
DCC_COMPLETION,
66
LOAD_COMPLETION,
67
SERVER_COMPLETION,
68
- CDCC_COMPLETION
69
+ CDCC_COMPLETION,
70
+ CUSTOM_COMPLETION,
71
+ TABKEY_OVERWRITE
72
};
73
74
- char *get_completions (enum completion, char *, int *, char **);
75
- int add_completion_type (char *, int, enum completion);
76
+ char *get_completions (enum completion *, char *, int *, char **, char * (*)(int, char *, int *, char **));
77
+ int add_completion_type (char *, int, enum completion, char * (*)(int, char *, int *, char **));
78
+
79
+void overwrite_tabkey_comp(int (*)(int, char *, int *, char **), char * (*)(int, char *, int *, char **));
80
81
extern NickTab *tabkey_array;
82
extern NickTab *autoreply_array;
83
--- .//source/modules.c.orig Tue Jan 18 01:38:07 2000
84
+++ .//source/modules.c Tue Jan 18 20:53:49 2000
85
@@ -423,6 +423,7 @@
86
global_table[RECALCULATE_WINDOW_CURSOR] = (Function_ptr) recalculate_window_cursor;
87
global_table[MAKE_WINDOW_CURRENT] = (Function_ptr) make_window_current;
88
global_table[CLEAR_SCROLLBACK] = (Function_ptr) clear_scrollback;
89
+ global_table[WINDOW_QUERY] = (Function_ptr) window_query;
90
91
global_table[RESET_DISPLAY_TARGET] = (Function_ptr) reset_display_target;
92
global_table[SET_DISPLAY_TARGET] = (Function_ptr) set_display_target;
93
@@ -475,6 +476,7 @@
94
global_table[GETCHANNICK] = (Function_ptr) getchannick;
95
global_table[LOOKUP_NICKCOMPLETION] = (Function_ptr) lookup_nickcompletion;
96
global_table[ADD_COMPLETION_TYPE] = (Function_ptr) add_completion_type;
97
+ global_table[OVERWRITE_TABKEY_COMP] = (Function_ptr) overwrite_tabkey_comp;
98
99
/* names.c */
100
global_table[IS_CHANOP] = (Function_ptr) is_chanop;
101
--- .//source/input.c.orig Tue Jan 18 15:58:30 2000
102
+++ .//source/input.c Thu Jan 20 20:10:02 2000
103
@@ -62,6 +62,9 @@
104
NickTab *tabkey_array = NULL, *autoreply_array = NULL;
105
106
107
+int (*do_over_write_tabkey_complete)(int, char *, int *, char **) = NULL;
108
+char * (*over_write_tabkey_complete_func)(int, char *, int *, char **) = NULL;
109
+
110
111
const int WIDTH = 10;
112
113
@@ -2119,7 +2122,8 @@
114
struct _ext_name_type *next;
115
char *name;
116
int len;
117
- enum completion type;
118
+ enum completion type;
119
+ char * (*comp_func)(int, char *, int *, char **);
120
} Ext_Name_Type;
121
122
Ext_Name_Type *ext_completion = NULL;
123
@@ -2161,7 +2165,14 @@
124
return NULL;
125
}
126
127
-char *get_completions(enum completion type, char *possible, int *count, char **suggested)
128
+void overwrite_tabkey_comp(int (*check)(int, char *, int *, char **) , char * (*overwrite)(int, char *, int *, char **) )
129
+{
130
+ do_over_write_tabkey_complete = check;
131
+ over_write_tabkey_complete_func = overwrite;
132
+ return;
133
+}
134
+
135
+char *get_completions(enum completion *t, char *possible, int *count, char **suggested, char * (*cf)(int, char *, int *, char **))
136
{
137
char *booya = NULL;
138
char *path = NULL;
139
@@ -2169,6 +2180,7 @@
140
glob_t globbers;
141
int numglobs = 0, i;
142
int globtype = GLOB_MARK;
143
+enum completion type = *t;
144
145
#if defined(__EMX__) || defined(WINNT)
146
if (possible && *possible)
147
@@ -2191,6 +2203,18 @@
148
case TABKEY_COMPLETION:
149
{
150
NickTab *n = tabkey_array;
151
+ /*
152
+ * bad hack
153
+ * better idea would be to make this into a list
154
+ * and allow multiple modules to create over writes
155
+ * then, go to the first module that says it wants to
156
+ * do a tab_complete
157
+ */
158
+ if ( do_over_write_tabkey_complete != NULL && over_write_tabkey_complete_func != NULL && do_over_write_tabkey_complete((int) type, possible, count, suggested) ) {
159
+ *t = TABKEY_OVERWRITE;
160
+ return over_write_tabkey_complete_func((int) type, possible, count, suggested);
161
+ }
162
+ /* put_it("opted not do!"); */
163
*count = 0;
164
if (possible)
165
{
166
@@ -2377,6 +2401,18 @@
167
#endif
168
break;
169
}
170
+ case CUSTOM_COMPLETION:
171
+ {
172
+ char *c;
173
+ if ( cf == NULL ) {
174
+ return NULL;
175
+ /* put_it("CF IS NULL!"); */
176
+ }
177
+ c = cf((int)type, possible, count ,suggested);
178
+ /* put_it(c); */
179
+ return c;
180
+ break;
181
+ }
182
default:
183
return NULL;
184
}
185
@@ -2507,6 +2543,7 @@
186
int got_space = 0;
187
char *get = NULL;
188
Ext_Name_Type *extcomp = ext_completion;
189
+char * (*cf)(int, char *, int *, char **) = NULL;
190
191
/*
192
* is this the != second word, then just complete from the
193
@@ -2597,6 +2634,7 @@
194
case CDCC:
195
if (wcount == 2 || wcount == 3)
196
type = CDCC_COMPLETION;
197
+
198
break;
199
}
200
break;
201
@@ -2609,6 +2647,7 @@
202
if (!my_strnicmp(p, extcomp->name, extcomp->len))
203
{
204
type = extcomp->type;
205
+ cf = extcomp->comp_func;
206
break;
207
}
208
}
209
@@ -2628,7 +2667,7 @@
210
#endif
211
do_more_tab:
212
count = 0;
213
- if ((get = get_completions(type, possible, &count, &suggested)))
214
+ if ((get = get_completions(&type, possible, &count, &suggested, cf)))
215
{
216
char buffer[BIG_BUFFER_SIZE+1];
217
char *p = NULL;
218
@@ -2640,8 +2679,11 @@
219
p = extract(get_input(), 0, wcount - 2);
220
else if (suggested && *suggested)
221
p = m_3dup("/", suggested, "");
222
- if (type == TABKEY_COMPLETION)
223
+
224
+ if (type == TABKEY_COMPLETION)
225
snprintf(buffer, BIG_BUFFER_SIZE, "%s %s%s%s ", (p && *p == '/') ? p : "/m", get, (p && (*p != '/'))?space:empty_string, (p && (*p != '/'))?p:empty_string);
226
+ else if ( type == TABKEY_OVERWRITE )
227
+ snprintf(buffer, BIG_BUFFER_SIZE, "%s",get);
228
else
229
{
230
if (wcount == 1 && got_space)
231
@@ -2729,10 +2771,11 @@
232
case SERVER_COMPLETION:
233
case TABKEY_COMPLETION:
234
case CHAN_COMPLETION:
235
+ case CUSTOM_COMPLETION:
236
{
237
char *n, *use = get;
238
n = new_next_arg(use, &use);
239
- count = 0;
240
+ count = 0;
241
while (n && *n)
242
{
243
strmcat(buffer, n, BIG_BUFFER_SIZE);
244
@@ -2750,6 +2793,7 @@
245
put_it("%s", convert_output_format(fget_string_var(FORMAT_COMPLETE_FSET),"%s", buffer));
246
break;
247
}
248
+ case TABKEY_OVERWRITE:
249
case NO_COMPLETION:
250
break;
251
default:
252
@@ -2776,15 +2820,16 @@
253
return;
254
}
255
256
-int add_completion_type(char *name, int len, enum completion type)
257
+int add_completion_type(char *name, int len, enum completion type, char * (*cf)(int, char *, int *, char **))
258
{
259
-Ext_Name_Type *new;
260
+ Ext_Name_Type *new;
261
if (!find_in_list((List **)&ext_completion, name, 0))
262
{
263
new = (Ext_Name_Type *)new_malloc(sizeof(Ext_Name_Type));
264
new->name = m_strdup(name);
265
new->len = len;
266
new->type = type;
267
+ new->comp_func =cf;
268
add_to_list((List **)&ext_completion, (List *)new);
269
return 1;
270
}
271
--- .//source/functions.c.orig Tue Jan 18 16:44:28 2000
272
+++ .//source/functions.c Thu Jan 20 17:10:53 2000
273
@@ -7020,8 +7020,9 @@
274
#ifdef WANT_TABKEY
275
char *ret, *possible;
276
int count = 0; /* 6 */
277
+enum completion comp_type = 3;
278
possible = next_arg(input, &input);
279
- ret = get_completions(3, possible, &count, NULL);
280
+ ret = get_completions(&comp_type, possible, &count, NULL, NULL);
281
return m_sprintf("%d %s", count, ret ? ret : empty_string);
282
#else
283
RETURN_EMPTY;
284
@@ -7033,8 +7034,9 @@
285
#ifdef WANT_TABKEY
286
char *ret, *possible;
287
int count = 0;/* 4 */
288
+enum completion comp_type = 7;
289
possible = next_arg(input, &input);
290
- ret = get_completions(7, possible, &count, NULL);
291
+ ret = get_completions(&comp_type, possible, &count, NULL, NULL);
292
return m_sprintf("%d %s", count, ret ? ret : empty_string);
293
#else
294
RETURN_EMPTY;
295
296