+static JubCLIUI *completionData;
+static void completionCallback(OFString *buf, OFList *lc)
+{
+ if ([buf length] < 3)
+ return;
+
+ if (![buf hasPrefix: @":s "] && ![buf hasPrefix: @":m "] &&
+ ![buf hasPrefix: @":t "])
+ return;
+
+ if ([buf hasPrefix: @":t"]) {
+ OFString *options[] = {
+ @":t available",
+ @":t away",
+ @":t dnd",
+ @":t xa",
+ @":t chat",
+ @":t unavailable"
+ };
+
+ for (int i = 0; i < 6; i++) {
+ if (![options[i] hasPrefix: buf])
+ continue;
+ [lc appendObject: options[i]];
+ }
+
+ return;
+ }
+
+ OFString *command = [buf substringWithRange: of_range(0, 3)];
+ OFString *query = [buf substringWithRange: of_range(3, [buf length]-3)];
+ OFDictionary *contacts = completionData.client.contactManager.contacts;
+ for (OFString *key in contacts) {
+ if (![key hasPrefix: query])
+ continue;
+ [lc appendObject: [command stringByAppendingString: key]];
+ }
+}
+