Read TeamSpeak 3 Messages with java - java

im wondering if there is any other way to read out the TeamSpeak Channel Chat with java.
I know that you could use a lua plugin which opens tha java program with the messages as parameter.
The code for the Lua Plugin's event.lua file: (could be outdated)
local function onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored)
print("Testmodule: onTextMessageEvent: " .. serverConnectionHandlerID .. " " .. targetMode .. " " .. toID .. " " .. fromID .. " " .. fromName .. " " .. fromUniqueIdentifier .. " " .. message .. " " .. ffIgnored)
if targetMode == 2 then
os.execute("Program.exe " .. '"' .. message .. '"')
if message == "!command#1" or message == "!command#2" or message == "!command#3" then
folder = os.getenv("APPDATA")
file = io.open(folder .. "/" .. "tmp.txt", "r")
tempfile = file:read("*all")
file:close()
os.remove(folder .. "/" .. "tmp.txt")
ts3.requestSendChannelTextMsg(serverConnectionHandlerID, tempfile, fromID)
end
end
return 0
end
Basicly the Program.exe creates the tmp.txt file and writes the specified (inside the Program.exe) answer to the file which is sent to the chat by the lua plugin.
Now i want to know if there is any way to get the messages directly with java (so that the lua plugin isn't needed anymore)
I'm thankful for any help

I found out that you can simply scan the channel & server chatlogs for new entrys.
The Logs can be found here:
%APPDATA%\Roaming\TS3Client\chats\<UniqueServerID>
Unfortunately i have no idea how the UniqueServerID is generated and where the private chatlogs can be found.

Related

Attaching xml file to mimeentity crashes Notes server

In an Java agent I generate a mail. When I send this only with text then the mail is sent to the recipient. I also want to attach an xml file to the mail. If I attach it my notes server crashes.
I think my code is wrong, this is the part where I want to add the attachment to the mail:
mime = mimeRoot.createChildEntity();
MIMEHeader hdr = mime.createHeader("Content-Disposition");
hdr.setHeaderValAndParams("attachment; filename=" + OrderFilePath);
Stream stream = session.createStream();
System.out.println("Open stream");
//AT THIS IF IT WILL CRASH THE SERVER
if (stream.open(OrderFilePath, "binary")){
System.out.println("in eerste if");
if (stream.getBytes() != 0) {
System.out.println("getbytes !0 ");
mime.setContentFromBytes(stream, "application/octet-stream",MIMEEntity.ENC_IDENTITY_BINARY);
}
else System.out.println
(OrderFilePath + "has no content or is not working");
}
I have some working LotusScript code that does almost the same, with the exception of two lines:
hdr.setHeaderValAndParams("attachment; filename=\\"" + OrderFilePath + "\\"");
and
mime.setContentFromBytes(stream, "application/octet-stream; name=\\"" + OrderFilePath + "\\"",MIMEEntity.ENC_IDENTITY_BINARY);
My LS code, so yo can see for yourself:
ForAll att In attachments
disposition= "attachment"
If att.isInLine Then disposition= "inline"
Set sect = body.createChildEntity()
Call sect.CreateHeader("Content-Disposition").SetHeaderValAndParams(disposition + {; filename="} & att.attName & {";"} )
Call sect.CreateHeader("Content-ID").SetHeaderVal( |<| & ListTag(att) & |>| )
Set stream = session.CreateStream
If stream.Open(att.attFile) Then
Call sect.SetContentFromBytes(stream, strContentType & {; name="} & att.attName & {"}, ENC_IDENTITY_BINARY)
Call stream.Close
End If
End Forall
attachments is a list of Attachment objects that contain only the name and the filepath of an attachment; it isn't a full Notes attachment embedded object thing.

Search for issues in current sprint in JIRA

I am trying to pull all issues (resolved or not) from the current sprint and display that information. I am using a JIRA REST Java client to achieve this. I am quite new to JIRA and the JRJC so would like all the help I can get really.
This is the code I have written so far:
SearchResult allIssuesInSprint = restClient.getSearchClient().searchJql("sprint = \"" + 29 + "\" order by rank").claim();
Iterable<Issue> allIssues = allIssuesInSprint.getIssues();
for (Issue issue : allIssues) {
System.out.println("Key: " + issue.getKey());
System.out.println("Type: " + issue.getIssueType());
System.out.println("Status: " + issue.getStatus());
System.out.println("Priority: " + issue.getPriority());
}
Again, I am new to JIRA's JAR files, so I'm not certain on how to use them. Any help would be appreciated.

Show Prolog "write" output in Console Java

I'm using JPL Libraries to link a Prolog program with Java interface.
I have a (working) JTextArea where I redirect everything that appears in Console, but I can't see the prolog "write" instruction.
I used this method for queries:
Query q2 = new Query(t2);
System.out.println("Query " + t2 + " is " + (q2.hasSolution()));
but when the query is false, the text in "write" parts of Prolog for example:
write('Sorry, you can''t go from the '), write(CurPlace), write(' to the '), write(Place), nl,
doesn't appear in JTextArea.
I tried also with System.out.println("first solution of " + q2 + ": X = " + q2.oneSolution().get("X")); but it doesn't work.
What happen in JTextArea is this:
Query goto(garage).
is false
but I expected also the "write" warnings contained in .pl file. For example:
write('Sorry, you don''t have the keys')

P4 edit can cause whitespace without edit?

I have a tool what uses Perforce. When it merge a branch back to the parent, mark the project branch with checkout a text file, and submit it unchanged. This tool also use that text file, for read the actual build number. My problem is, a "/n" appeared in the text, and because it have to contain just numbers, it's a big problem.
Have anyone met this problem, or this can't caused by P4C?
Maybe important, I don't use P4JAVA here.
Please note that I'm debugging right now, and I'm not sure the problem is here, but at the moment this seems the most probable.
//<path> is a legit path, I just shortened the code here
commandSync = "p4 -d " + getPerforceRoot() + " sync " + selectedDataBean.getP4Path() + "<path>/BuildNum.txt";
CommandResultBean syncCommandResult = commandExecuter.runAndGetResults(commandSync);
//command executer that runs the command string in cmd
commandMark = "p4 -d " + getPerforceRoot() + " edit -c " + changelistNumber + " " + selectedDataBean.getP4Path() + "<path>/BuildNum.txt";
CommandResultBean markCommandResult = commandExecuter.runAndGetResults(commandMark);
commandSubmit = "p4 -d " + getPerforceRoot() + " submit -f submitunchanged -c " + changelistNumber;
CommandResultBean submitCommandResult = commandExecuter.runAndGetResults(commandSubmit);

How to send content of a file in a tSendMail

i try since some days to send one mail with different informations from child job and father job.
see my jobs below:
and my tRunJob_3
at the end of this job, i can put informations from tAggregateRow in the email, but it send several email (one mail by condition "if" approved DeinitJob --- if --- tRunJob_3)
my file generated by tFileOutputDelimited_1 in the father job contains all the information i need to put in the final mail.
1: how to display these informations in one email (no attachement) ?
2: i have this error in my console:
For input string: "7.91'7.91"
multiple points
what it means ?
EDIT:
with the modification below, it send me 1 email with the informations collected
in my tjavaflex:
code initial
// start part of your Java code
boolean loop ;
System.out.println("## START\n#");
code principal
// here is the main part of the component,
// a piece of code executed in the row
// loop
// code sample:
System.out.println("## LOAD...\n#");
if ((String)globalMap.get("message") != null) {
globalMap.put("message", (String)globalMap.get("message") + row5.mag + " qt: " + row5.qt + " p1: " + row5.p1 + "\n" ) ;
}
code final:
// end of the component, outside/closing the loop
loop = true ;
System.out.println("## END\n#");
with a if loop between tjava and tsendmail
but still have my error:
For input string: "7.91'7.91"
multiple points

Categories