ejabberd - Get publisher JID in pubsub item - xmpp

http://www.xmpp.org/extensions/xep-0060.html#impl-association defines an attribute called 'itemreply' that lets you add the publisher information along with the item being published. It doesn't look like ejabberd has implemented the above option. Is there any other workaround for this ?
According to https://support.process-one.net/browse/EJAB-1347 there is an patch available that can accomplish it but i am not sure on how to apply the patch. Looking for guidance on the same.
Thanks,
Mithun

The patch is too old to apply as is on ejabberd code base. It would need to be updated to latest version, but I do not think it is a highly requested feature.
You should probably submit a feature request on project Github: https://github.com/processone/ejabberd/issues

Managed to change the code to add publisher information. Here are the steps needed to to the same.
1) open the file src/mod_pubsub.erl
2) Find the following function
itemAttr(ItemId) -> [{<<"id">>, ItemId}].
3) Add a new function below the above mentioned function
itemAttr(ItemId, From) -> [{<<"id">>, ItemId},{<<"publisher">>, From}].
4) Next find the function named
broadcast_publish_item(Host, Node, Nidx, Type, NodeOptions, ItemId, From, Payload, Removed) ->
5) Replace
Stanza = event_stanza(
[#xmlel{name = <<"items">>, attrs = nodeAttr(Node),
children = [#xmlel{name = <<"item">>, attrs = itemAttr(ItemId),
children = Content}]}]),
with
Stanza = event_stanza(
[#xmlel{name = <<"items">>, attrs = nodeAttr(Node),
children = [#xmlel{name = <<"item">>, attrs = itemAttr(ItemId, jlib:jid_to_string(From)),
children = Content}]}]),
6) Recompile the code using
sudo make; sudo make install;
Restart your server and you should get the publisher information along with the item being published.

Related

Add non-standard segments with nhapi

My system has to generate an xml in which the node ORM_O01.ORDER_DETAIL must contain the node ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP, because it has to communicate with Mirth.
I am using the nhapi library version 2.5, in which this node does not contain it.
var obr = _ormO01Message.GetORDER().ORDER_DETAIL.OBR;
obr.SetIDOBR.Value = "1";
obr.PlacerOrderNumber.EntityIdentifier.Value = "123456";
obr.PlacerOrderNumber.NamespaceID.Value = "6543";
obr.PlacerOrderNumber.UniversalID.Value = "10009";
obr.UniversalServiceIdentifier.Identifier.Value = "NS";
Is it possible to add a node in ORM_O01.ORDER_DETAIL that is not standard?
Thanks.
<ORM_O01.ORDER_DETAIL>
<ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP>
<OBR>
<OBR.1>1</OBR.1>
<OBR.2>
<EI.1>123456</EI.1>
<EI.2>6543</EI.2>
<EI.3>10009</EI.3>
</OBR.2>
<OBR.4>
<CE.1>NS</CE.1>
</OBR.4>
</OBR>
</ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP>
</ORM_O01.ORDER_DETAIL>
ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP looks like it actually is standard for 2.5, but neither nhapi or hapi (which mirth uses) include it. I wouldn't worry about trying to add it in because mirth probably wouldn't be able to parse it if you did.
See similar issue where a mirth user needed to strip that group out.

Aha!<>VSTS Integration - Aha! adjusted Stack Rank in VSTS - tips on reverting?

While integrating with VSTS, I accidentally wiped out the stack rank in VSTS for my 100+ features. My first choice would be to undo the import. Does anyone know how I could revert the action on either the Aha or VSTS side? My second choice would be to edit one by one. I can go into the details of each story and see the original stack rank, but I can't seem to be able to find where I could then reenter it one by one.
If there isn't any other action performed on these work items after that, the quick way is getting the Stack Rank value in the previous revision of the work items and updating the work items with the returned stack rand via coding. Following is the code sample to update the value of Stack Rank to previous version for a single work item:
using Microsoft.TeamFoundation.Client;
using System;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace ConsoleX
{
class Program
{
static void Main(string[] args)
{
Uri url = new Uri("https://vstsaccount.visualstudio.com");
TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(url);
WorkItemStore wis = ttpc.GetService<WorkItemStore>();
int workitemid = 12;
WorkItem wi = wis.GetWorkItem(workitemid);
int previousrevision = wi.Revision - 2;
string previousstackrank = wi.Revisions[previousrevision].Fields["Stack Rank"].Value.ToString();
wi.Fields["Stack Rank"].Value = previousstackrank;
wi.Save();
}
}
}
For you scenario, just add some code to query that 100+ features and update them one by one.

Oracle UCM - ridc - get all versions of document

I am getting files from Oracle UCM via RIDC. I am using DataBinder as follows :
IdcClient client =getUCMConnection();
DataBinder dataBinder = client.createBinder ();
dataBinder.putLocal ("IdcService", "GET_FILE");
dataBinder.putLocal ("dID", dID);
IdcContext userContext = new IdcContext(username);
ServiceResponse response = client.sendRequest (userContext, dataBinder);
InputStream fstream = response.getResponseStream ();
....... etc.
I want to ask, how can I get "ALL VERSIONS" of a document instead of latest released one?
First you have to call the service DOC_INFO, you can get the result set of the revision by using the REVISION_HISTORY set.
You will get specific dID for each version, you iterate them and use GET_FILE with dID as a parameter for each one of them
I can't test it right now but I think the service you are looking for is GET_INFO, try it and check all the resultsets you get I'm pretty sure one of them has the info for all the document's revisions.
You can use the service REV_HISTORY to get the result set REVISIONS which contains info of all the revisions.

QBO Queries and SpecifyOperatorOption

I'm trying to query QBO for, among other entities, Accounts, and am running into a couple of issues. I'm using the .Net Dev Kit v 2.1.10.0 (I used NuGet to update to the latest version) and when I use the following technique:
Intuit.Ipp.Data.Qbo.AccountQuery cquery = new Intuit.Ipp.Data.Qbo.AccountQuery();
IEnumerable<Intuit.Ipp.Data.Qbo.Account> qboAccounts = cquery.ExecuteQuery<Intuit.Ipp.Data.Qbo.Account>(context);
(i.e. just create a new AccountQuery of the appropriate type and call ExecuteQuery) I get an error. It seems that the request XML is not created properly, I just see one line in the XML file. I then looked at the online docs and tried to emulate the code there:
Intuit.Ipp.Data.Qbo.AccountQuery cquery = new Intuit.Ipp.Data.Qbo.AccountQuery();
cquery.CreateTime = DateTime.Now.Date.AddDays(-20);
cquery.SpecifyOperatorOption(Intuit.Ipp.Data.Qbo.FilterProperty.CreateTime,
Intuit.Ipp.Data.Qbo.FilterOperatorType.AFTER);
cquery.CreateTime = DateTime.Now.Date;
cquery.SpecifyOperatorOption(Intuit.Ipp.Data.Qbo.FilterProperty.CreateTime,
Intuit.Ipp.Data.Qbo.FilterOperatorType.BEFORE);
// Specify a Request validator
Intuit.Ipp.Data.Qbo.AccountQuery cquery = new Intuit.Ipp.Data.Qbo.AccountQuery();
IEnumerable<Intuit.Ipp.Data.Qbo.Account> qboAccounts = cquery.ExecuteQuery<Intuit.Ipp.Data.Qbo.Account>(context);
unfortunately, VS 2010 insists that AccountQuery doesn't contain a definition for SpecifyOperatorOption and there is no extension method by that name. So I'm stuck.
Any ideas how to resolve this would be appreciated.

How to add some extra parameter in the airbrake parameters for JS errors

When we are sending the airbrake error to the airbrake server, by default it includes the controller name and action name.
But the question is that I want to add some extra parameters like username, email of the current user. If anyone has any idea please suggest how to do that?
In my layout application.html:
- if ['development'].include?(Rails.env)
= airbrake_javascript_notifier
= render :partial => 'layouts/airbrake_notifier'
and in the partial I have written:
Airbrake.errorDefaults['name'] = "#{current_user.name}";<br/>
Airbrake.errorDefaults['email'] = "#{current_user.email}";<br/>
Airbrake.errorDefaults['phone'] = "#{current_user.phone}";<br/>
Airbrake.errorDefaults['title'] = "#{current_user.title;<br/>
Not a great solution, but the Airbrake Knowledge Base recommends essentially patching the airbrake gem source of the lib/airbrake/notice.rb file.
def initialize(args)
...
self.parameters = args[:parameters] ||
action_dispatch_params ||
rack_env(:params) ||
{'username' => current_user.name}
It would certainly be better to have this be configurable without patching source.
What I've done instead is simply add a few pieces of data to the session (current_user.name mainly), since session data is sent with the request. I wouldn't do this for more than a few little pieces of data.
We've just added getting current users into the Airbrake Gem.
https://github.com/airbrake/airbrake/wiki/Sending-current-user-information
You'll soon be able to sort by current user in an upcoming redesign of the UI.