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
|
||||
if g.XMPP_IQ_RemoteRoster_Request[iq.Id] == RemoteRosterRequestPermission {
|
||||
delete(g.XMPP_IQ_RemoteRoster_Request, iq.Id)
|
||||
if g.XMPP_IQ_RemoteRoster_Request[iq.ID] == RemoteRosterRequestPermission {
|
||||
delete(g.XMPP_IQ_RemoteRoster_Request, iq.ID)
|
||||
|
||||
if iq.Type == xmpp.IQTypeError && iq.Error.Condition() == xmpp.ErrorForbidden {
|
||||
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
|
||||
iqId := NextIqId()
|
||||
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{})
|
||||
g.XMPP_Out <- iqSend
|
||||
}
|
||||
ret = true
|
||||
|
||||
} else if g.XMPP_IQ_RemoteRoster_Request[iq.Id] == RemoteRosterRequestRoster {
|
||||
delete(g.XMPP_IQ_RemoteRoster_Request, iq.Id)
|
||||
} else if g.XMPP_IQ_RemoteRoster_Request[iq.ID] == RemoteRosterRequestRoster {
|
||||
delete(g.XMPP_IQ_RemoteRoster_Request, iq.ID)
|
||||
if iq.Type == xmpp.IQTypeResult && iq.PayloadName().Space == xmpp.NSRoster {
|
||||
g.AllowEditRoster = true
|
||||
} else {
|
||||
|
|
@ -221,7 +221,7 @@ func (g *GatewayInfo) SendXmppPresence(status, tpye, to, from, message, nick str
|
|||
}
|
||||
|
||||
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{}
|
||||
queryItem := &xmpp.RosterItem{JID: jid, Name: nick, Subscription: xmpp.RosterSubscriptionBoth}
|
||||
queryItem.Groupes = append(queryItem.Groupes, XmppGroupUser)
|
||||
|
|
@ -234,7 +234,7 @@ func (g *GatewayInfo) addUserIntoRoster(jid, nick string) {
|
|||
func (g *GatewayInfo) removeAllUserFromRoster() {
|
||||
// Friends
|
||||
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.Items = append(query.Items, *&xmpp.RosterItem{JID: steamId.ToString() + "@" + XmppJidComponent, Subscription: xmpp.RosterSubscriptionRemove})
|
||||
iq.PayloadEncode(query)
|
||||
|
|
@ -242,7 +242,7 @@ func (g *GatewayInfo) removeAllUserFromRoster() {
|
|||
g.XMPP_Out <- iq
|
||||
}
|
||||
// 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.Items = append(query.Items, *&xmpp.RosterItem{JID: g.SteamClient.SteamId().ToString() + "@" + XmppJidComponent, Subscription: xmpp.RosterSubscriptionRemove})
|
||||
iq.PayloadEncode(query)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ var (
|
|||
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")
|
||||
|
||||
// Disco Ad-Hoc
|
||||
|
|
@ -67,7 +67,7 @@ func execDiscoCommand(iq *xmpp.Iq) {
|
|||
comp.Out <- reply
|
||||
}
|
||||
|
||||
func execDisco(iq *xmpp.Iq) {
|
||||
func execDisco(iq *xmpp.IQ) {
|
||||
logger.Info.Printf("Disco Feature")
|
||||
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{}
|
||||
iq.PayloadDecode(adHoc)
|
||||
jidBareFrom := strings.SplitN(iq.From, "/", 2)[0]
|
||||
|
|
@ -317,7 +317,7 @@ func getXFormRegistration(steamLogin string) *xmpp.AdHocXForm {
|
|||
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
|
||||
steamLogin := ""
|
||||
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.")
|
||||
}
|
||||
|
||||
case *xmpp.Iq:
|
||||
case *xmpp.IQ:
|
||||
jidBareFrom := strings.SplitN(v.From, "/", 2)[0]
|
||||
jidBareTo := strings.SplitN(v.To, "/", 2)[0]
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ func must(v interface{}, err error) interface{} {
|
|||
return v
|
||||
}
|
||||
|
||||
func treatmentNSRegister(iq *xmpp.Iq) {
|
||||
func treatmentNSRegister(iq *xmpp.IQ) {
|
||||
reply := iq.Response(xmpp.IQTypeResult)
|
||||
jidBareFrom := strings.SplitN(iq.From, "/", 2)[0]
|
||||
registerQuery := &xmpp.RegisterQuery{}
|
||||
|
|
@ -208,12 +208,12 @@ func treatmentNSRegister(iq *xmpp.Iq) {
|
|||
comp.Out <- reply
|
||||
}
|
||||
|
||||
func treatmentNSPing(iq *xmpp.Iq) {
|
||||
func treatmentNSPing(iq *xmpp.IQ) {
|
||||
reply := iq.Response(xmpp.IQTypeResult)
|
||||
comp.Out <- reply
|
||||
}
|
||||
|
||||
func sendNotSupportedFeature(iq *xmpp.Iq) {
|
||||
func sendNotSupportedFeature(iq *xmpp.IQ) {
|
||||
if iq.Type != xmpp.IQTypeError && iq.Type != xmpp.IQTypeResult {
|
||||
reply := iq.Response(xmpp.IQTypeError)
|
||||
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
|
||||
iqId := gateway.NextIqId()
|
||||
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.RemoteRosterManagerQuery{Reason: "Manage contacts in the Steam contact list", Type: xmpp.RemoteRosterManagerTypeRequest})
|
||||
comp.Out <- iq
|
||||
|
|
|
|||
Loading…
Reference in New Issue