Modification because of un-golang fix names in lib go-xmpp.
This commit is contained in:
parent
4f860c3f59
commit
4a3fdd3da1
|
|
@ -136,10 +136,10 @@ func (g *GatewayInfo) ReceivedXMPP_Message(message *xmpp.Message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GatewayInfo) ReceivedXMPP_IQ(iq *xmpp.Iq) bool {
|
func (g *GatewayInfo) ReceivedXMPP_IQ(iq *xmpp.IQ) bool {
|
||||||
ret := false
|
ret := false
|
||||||
if g.XMPP_IQ_RemoteRoster_Request[iq.Id] == RemoteRosterRequestPermission {
|
if g.XMPP_IQ_RemoteRoster_Request[iq.ID] == RemoteRosterRequestPermission {
|
||||||
delete(g.XMPP_IQ_RemoteRoster_Request, iq.Id)
|
delete(g.XMPP_IQ_RemoteRoster_Request, iq.ID)
|
||||||
|
|
||||||
if iq.Type == xmpp.IQTypeError && iq.Error.Condition() == xmpp.ErrorForbidden {
|
if iq.Type == xmpp.IQTypeError && iq.Error.Condition() == xmpp.ErrorForbidden {
|
||||||
g.AllowEditRoster = false
|
g.AllowEditRoster = false
|
||||||
|
|
@ -161,14 +161,14 @@ func (g *GatewayInfo) ReceivedXMPP_IQ(iq *xmpp.Iq) bool {
|
||||||
// Remote roster namespace may not be supported (like prosody), so we send a roster query
|
// Remote roster namespace may not be supported (like prosody), so we send a roster query
|
||||||
iqId := NextIqId()
|
iqId := NextIqId()
|
||||||
g.XMPP_IQ_RemoteRoster_Request[iqId] = RemoteRosterRequestRoster
|
g.XMPP_IQ_RemoteRoster_Request[iqId] = RemoteRosterRequestRoster
|
||||||
iqSend := &xmpp.Iq{Id: iqId, Type: xmpp.IQTypeGet, From: iq.To, To: iq.From}
|
iqSend := &xmpp.IQ{ID: iqId, Type: xmpp.IQTypeGet, From: iq.To, To: iq.From}
|
||||||
iqSend.PayloadEncode(&xmpp.RosterQuery{})
|
iqSend.PayloadEncode(&xmpp.RosterQuery{})
|
||||||
g.XMPP_Out <- iqSend
|
g.XMPP_Out <- iqSend
|
||||||
}
|
}
|
||||||
ret = true
|
ret = true
|
||||||
|
|
||||||
} else if g.XMPP_IQ_RemoteRoster_Request[iq.Id] == RemoteRosterRequestRoster {
|
} else if g.XMPP_IQ_RemoteRoster_Request[iq.ID] == RemoteRosterRequestRoster {
|
||||||
delete(g.XMPP_IQ_RemoteRoster_Request, iq.Id)
|
delete(g.XMPP_IQ_RemoteRoster_Request, iq.ID)
|
||||||
if iq.Type == xmpp.IQTypeResult && iq.PayloadName().Space == xmpp.NSRoster {
|
if iq.Type == xmpp.IQTypeResult && iq.PayloadName().Space == xmpp.NSRoster {
|
||||||
g.AllowEditRoster = true
|
g.AllowEditRoster = true
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -221,7 +221,7 @@ func (g *GatewayInfo) SendXmppPresence(status, tpye, to, from, message, nick str
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GatewayInfo) addUserIntoRoster(jid, nick string) {
|
func (g *GatewayInfo) addUserIntoRoster(jid, nick string) {
|
||||||
iq := xmpp.Iq{To: g.XMPP_JID_Client, Type: xmpp.IQTypeSet, Id: NextIqId()}
|
iq := xmpp.IQ{To: g.XMPP_JID_Client, Type: xmpp.IQTypeSet, ID: NextIqId()}
|
||||||
query := &xmpp.RosterQuery{}
|
query := &xmpp.RosterQuery{}
|
||||||
queryItem := &xmpp.RosterItem{JID: jid, Name: nick, Subscription: xmpp.RosterSubscriptionBoth}
|
queryItem := &xmpp.RosterItem{JID: jid, Name: nick, Subscription: xmpp.RosterSubscriptionBoth}
|
||||||
queryItem.Groupes = append(queryItem.Groupes, XmppGroupUser)
|
queryItem.Groupes = append(queryItem.Groupes, XmppGroupUser)
|
||||||
|
|
@ -234,7 +234,7 @@ func (g *GatewayInfo) addUserIntoRoster(jid, nick string) {
|
||||||
func (g *GatewayInfo) removeAllUserFromRoster() {
|
func (g *GatewayInfo) removeAllUserFromRoster() {
|
||||||
// Friends
|
// Friends
|
||||||
for steamId := range g.SteamClient.Social.Friends.GetCopy() {
|
for steamId := range g.SteamClient.Social.Friends.GetCopy() {
|
||||||
iq := xmpp.Iq{To: g.XMPP_JID_Client, Type: xmpp.IQTypeSet, Id: NextIqId()}
|
iq := xmpp.IQ{To: g.XMPP_JID_Client, Type: xmpp.IQTypeSet, ID: NextIqId()}
|
||||||
query := &xmpp.RosterQuery{}
|
query := &xmpp.RosterQuery{}
|
||||||
query.Items = append(query.Items, *&xmpp.RosterItem{JID: steamId.ToString() + "@" + XmppJidComponent, Subscription: xmpp.RosterSubscriptionRemove})
|
query.Items = append(query.Items, *&xmpp.RosterItem{JID: steamId.ToString() + "@" + XmppJidComponent, Subscription: xmpp.RosterSubscriptionRemove})
|
||||||
iq.PayloadEncode(query)
|
iq.PayloadEncode(query)
|
||||||
|
|
@ -242,7 +242,7 @@ func (g *GatewayInfo) removeAllUserFromRoster() {
|
||||||
g.XMPP_Out <- iq
|
g.XMPP_Out <- iq
|
||||||
}
|
}
|
||||||
// Myself
|
// Myself
|
||||||
iq := xmpp.Iq{To: g.XMPP_JID_Client, Type: xmpp.IQTypeSet, Id: NextIqId()}
|
iq := xmpp.IQ{To: g.XMPP_JID_Client, Type: xmpp.IQTypeSet, ID: NextIqId()}
|
||||||
query := &xmpp.RosterQuery{}
|
query := &xmpp.RosterQuery{}
|
||||||
query.Items = append(query.Items, *&xmpp.RosterItem{JID: g.SteamClient.SteamId().ToString() + "@" + XmppJidComponent, Subscription: xmpp.RosterSubscriptionRemove})
|
query.Items = append(query.Items, *&xmpp.RosterItem{JID: g.SteamClient.SteamId().ToString() + "@" + XmppJidComponent, Subscription: xmpp.RosterSubscriptionRemove})
|
||||||
iq.PayloadEncode(query)
|
iq.PayloadEncode(query)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ var (
|
||||||
identityClients = &xmpp.DiscoIdentity{Category: "client", Type: "pc", Name: "Steam client"}
|
identityClients = &xmpp.DiscoIdentity{Category: "client", Type: "pc", Name: "Steam client"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func execDiscoCommand(iq *xmpp.Iq) {
|
func execDiscoCommand(iq *xmpp.IQ) {
|
||||||
logger.Info.Printf("Ad-Hoc Command")
|
logger.Info.Printf("Ad-Hoc Command")
|
||||||
|
|
||||||
// Disco Ad-Hoc
|
// Disco Ad-Hoc
|
||||||
|
|
@ -67,7 +67,7 @@ func execDiscoCommand(iq *xmpp.Iq) {
|
||||||
comp.Out <- reply
|
comp.Out <- reply
|
||||||
}
|
}
|
||||||
|
|
||||||
func execDisco(iq *xmpp.Iq) {
|
func execDisco(iq *xmpp.IQ) {
|
||||||
logger.Info.Printf("Disco Feature")
|
logger.Info.Printf("Disco Feature")
|
||||||
jidBareTo := strings.SplitN(iq.To, "/", 2)[0]
|
jidBareTo := strings.SplitN(iq.To, "/", 2)[0]
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ func execDisco(iq *xmpp.Iq) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func execCommandAdHoc(iq *xmpp.Iq) {
|
func execCommandAdHoc(iq *xmpp.IQ) {
|
||||||
adHoc := &xmpp.AdHocCommand{}
|
adHoc := &xmpp.AdHocCommand{}
|
||||||
iq.PayloadDecode(adHoc)
|
iq.PayloadDecode(adHoc)
|
||||||
jidBareFrom := strings.SplitN(iq.From, "/", 2)[0]
|
jidBareFrom := strings.SplitN(iq.From, "/", 2)[0]
|
||||||
|
|
@ -317,7 +317,7 @@ func getXFormRegistration(steamLogin string) *xmpp.AdHocXForm {
|
||||||
return cmdXForm
|
return cmdXForm
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUser(fields []xmpp.AdHocField, iq *xmpp.Iq) *database.DatabaseLine {
|
func getUser(fields []xmpp.AdHocField, iq *xmpp.IQ) *database.DatabaseLine {
|
||||||
// Command Auth Code
|
// Command Auth Code
|
||||||
steamLogin := ""
|
steamLogin := ""
|
||||||
steamPwd := ""
|
steamPwd := ""
|
||||||
|
|
|
||||||
10
xmpp/xmpp.go
10
xmpp/xmpp.go
|
|
@ -85,7 +85,7 @@ func mainXMPP() {
|
||||||
SendMessage(v.From, "", "Your are not registred. If you want to register, please, send an Ad-Hoc command.")
|
SendMessage(v.From, "", "Your are not registred. If you want to register, please, send an Ad-Hoc command.")
|
||||||
}
|
}
|
||||||
|
|
||||||
case *xmpp.Iq:
|
case *xmpp.IQ:
|
||||||
jidBareFrom := strings.SplitN(v.From, "/", 2)[0]
|
jidBareFrom := strings.SplitN(v.From, "/", 2)[0]
|
||||||
jidBareTo := strings.SplitN(v.To, "/", 2)[0]
|
jidBareTo := strings.SplitN(v.To, "/", 2)[0]
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ func must(v interface{}, err error) interface{} {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func treatmentNSRegister(iq *xmpp.Iq) {
|
func treatmentNSRegister(iq *xmpp.IQ) {
|
||||||
reply := iq.Response(xmpp.IQTypeResult)
|
reply := iq.Response(xmpp.IQTypeResult)
|
||||||
jidBareFrom := strings.SplitN(iq.From, "/", 2)[0]
|
jidBareFrom := strings.SplitN(iq.From, "/", 2)[0]
|
||||||
registerQuery := &xmpp.RegisterQuery{}
|
registerQuery := &xmpp.RegisterQuery{}
|
||||||
|
|
@ -208,12 +208,12 @@ func treatmentNSRegister(iq *xmpp.Iq) {
|
||||||
comp.Out <- reply
|
comp.Out <- reply
|
||||||
}
|
}
|
||||||
|
|
||||||
func treatmentNSPing(iq *xmpp.Iq) {
|
func treatmentNSPing(iq *xmpp.IQ) {
|
||||||
reply := iq.Response(xmpp.IQTypeResult)
|
reply := iq.Response(xmpp.IQTypeResult)
|
||||||
comp.Out <- reply
|
comp.Out <- reply
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendNotSupportedFeature(iq *xmpp.Iq) {
|
func sendNotSupportedFeature(iq *xmpp.IQ) {
|
||||||
if iq.Type != xmpp.IQTypeError && iq.Type != xmpp.IQTypeResult {
|
if iq.Type != xmpp.IQTypeError && iq.Type != xmpp.IQTypeResult {
|
||||||
reply := iq.Response(xmpp.IQTypeError)
|
reply := iq.Response(xmpp.IQTypeError)
|
||||||
reply.PayloadEncode(xmpp.NewError("cancel", xmpp.ErrorFeatureNotImplemented, ""))
|
reply.PayloadEncode(xmpp.NewError("cancel", xmpp.ErrorFeatureNotImplemented, ""))
|
||||||
|
|
@ -293,7 +293,7 @@ func AddNewUser(jidUser, steamLogin, steamPwd string, debugMessage bool) {
|
||||||
// Ask if remote roster is allow
|
// Ask if remote roster is allow
|
||||||
iqId := gateway.NextIqId()
|
iqId := gateway.NextIqId()
|
||||||
g.XMPP_IQ_RemoteRoster_Request[iqId] = gateway.RemoteRosterRequestPermission
|
g.XMPP_IQ_RemoteRoster_Request[iqId] = gateway.RemoteRosterRequestPermission
|
||||||
iq := xmpp.Iq{To: jidUser, From: jid.Domain, Type: xmpp.IQTypeGet, Id: iqId}
|
iq := xmpp.IQ{To: jidUser, From: jid.Domain, Type: xmpp.IQTypeGet, ID: iqId}
|
||||||
// iq.PayloadEncode(&xmpp.RosterQuery{})
|
// iq.PayloadEncode(&xmpp.RosterQuery{})
|
||||||
iq.PayloadEncode(&xmpp.RemoteRosterManagerQuery{Reason: "Manage contacts in the Steam contact list", Type: xmpp.RemoteRosterManagerTypeRequest})
|
iq.PayloadEncode(&xmpp.RemoteRosterManagerQuery{Reason: "Manage contacts in the Steam contact list", Type: xmpp.RemoteRosterManagerTypeRequest})
|
||||||
comp.Out <- iq
|
comp.Out <- iq
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue