/// <summary> /// Sends an acknowledgement of the server's rate limitations -- SNAC(01,08) /// </summary> /// <param name="dp">A <see cref="DataPacket"/> object</param> /// <param name="classes">The known rate classes to acknowledge</param> public static void AcknowledgeRateLimitations(DataPacket dp, ushort[] classes) { Session sess = dp.ParentSession; SNACHeader sh = new SNACHeader(); sh.FamilyServiceID = (ushort)SNACFamily.BasicOscarService; sh.FamilySubtypeID = (ushort)GenericServiceControls.AcknowledgeRateLimits; sh.Flags = 0x0000; sh.RequestID = Session.GetNextRequestID(); ByteStream stream = new ByteStream(); for (int i = 0; i < classes.Length; i++) { stream.WriteUshort(classes[i]); } DataPacket dp2 = Marshal.BuildDataPacket(sess, sh, stream); dp2.ParentConnection = dp.ParentConnection; SNACFunctions.BuildFLAP(dp2); sess.OnLoginStatusUpdate("Protocol negotiation complete", 0.66); /* * If this is the initial services connection, we call the remaining SNACs * in the login sequence. * Otherwise, this is the last step in setting up a new service connection, * and we send SNAC(01,02) here. */ if (!sess.LoggedIn) { // Start stage 3, services setup RequestOwnInformation(sess); SNAC13.RequestParametersList(sess); SNAC13.RequestInitialContactList(sess); sess.Statuses.RequestParameters(); sess.Messages.RequestParametersList(); SNAC09.RequestParametersList(sess); sess.Statuses.ReportClientCapabilities(); sess.Statuses.SetProfile(sess.Statuses.Profile); } else { SendReadyNotification(dp); } }
public static void ProcessSNAC(DataPacket dp) { switch ((SNACFamily)dp.SNAC.FamilyServiceID) { case SNACFamily.DirectoryUserSearch: { DirectorySearch sub = (DirectorySearch)dp.SNAC.FamilySubtypeID; switch (sub) { case DirectorySearch.ClientServerError: // 0x0001 SNACFunctions.ProcessErrorNotification(dp); break; case DirectorySearch.SearchUserResponse: // 0x0003 SNAC0F.ProcessSearchResults(dp); break; case DirectorySearch.InterestsListResponse: // 0x0005 SNAC0F.ProcessInterestList(dp); break; } } break; case SNACFamily.LocationService: { LocationServices sub = (LocationServices)dp.SNAC.FamilySubtypeID; switch (sub) { case LocationServices.ClientServerError: // 0x0001 SNACFunctions.ProcessErrorNotification(dp); break; case LocationServices.UpdateDirectoryInfoResponse: // 0x000A SNAC02.ProcessUpdateResult(dp); break; case LocationServices.SNAC020BReply: SNAC02.ProcessSelfLocationReply(dp); // 0x000C break; case LocationServices.UpdateInterestsResponse: // 0x0010 SNAC02.ProcessUpdateResult(dp); break; default: break; } } break; case SNACFamily.PrivacyManagementService: { PrivacyManagementService sub = (PrivacyManagementService)dp.SNAC.FamilySubtypeID; switch (sub) { case PrivacyManagementService.ClientServerError: // 0x0001 SNACFunctions.ProcessErrorNotification(dp); break; case PrivacyManagementService.ServiceParametersRequest: // 0x0002 SNAC09.ProcessParametersListRequest(dp); break; case PrivacyManagementService.ServiceParametersResponse: // 0x0003 SNAC09.ProcessParametersList(dp); break; case PrivacyManagementService.ServiceError: break; default: break; } } break; case SNACFamily.SSIService: { SSIService sub = (SSIService)dp.SNAC.FamilySubtypeID; switch (sub) { case SSIService.ClientServerError: // 0x0001 SNACFunctions.ProcessErrorNotification(dp); break; case SSIService.ServiceParametersResponse: // 0x0003 SNAC13.ProcessParametersList(dp); break; case SSIService.ContactListResponse: // 0x0006 SNAC13.ProcessBuddyList(dp); break; case SSIService.SSIEditAddItems: // 0x0008 SNAC13.ProcessItemsAdded(dp); break; case SSIService.SSIEditUpdateGroupHeader: // 0x0009 SNAC13.ProcessItemsModified(dp); break; case SSIService.SSIEditRemoveItem: // 0x000A SNAC13.ProcessItemsRemoved(dp); break; case SSIService.SSIEditAcknowledge: // 0x000E SNAC13.ProcessSSIUpdateResponse(dp); break; case SSIService.LocalSSIUpToDate: // 0x000F SNAC13.ProcessSSIUpToDate(dp); break; case SSIService.YouWereAddedMessage: // 0x001C SNAC13.ProcessAddedMessage(dp); break; case SSIService.AuthorizationResponse: // 0x001B SNAC13.ProcessAuthorizationResponse(dp); break; case SSIService.FutureAuthorizationGranted: // 0x0015 SNAC13.ProcessFutureAuthorizationGrant(dp); break; case SSIService.AuthorizationRequest: //0x0019 SNAC13.ProcessAuthorizationRequest(dp); break; default: break; } } break; default: StringBuilder sb = new StringBuilder(); sb.AppendFormat( System.Globalization.CultureInfo.CurrentCulture.NumberFormat, "Unknown SNAC: ({0:x4},{1:x4}), flags = {2:x4}, requestID = {3:x8}", dp.SNAC.FamilyServiceID, dp.SNAC.FamilySubtypeID, dp.SNAC.Flags, dp.SNAC.RequestID); Logging.DumpFLAP(dp.Data.GetBytes(), sb.ToString()); break; } }